Advertisement
obernardovieira

AM2 1º desafio [Mathematica Challenge]

Feb 19th, 2015
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. n = int(input('Qual o grau do polimonio?'))
  2. a = [0]*(n+1)
  3.  
  4. for v in range(n, -1, -1):
  5.     input_text = "Introduza um valor para o 'a' na ordem #%d" % v
  6.     a[v] = int(input(input_text))
  7.  
  8. x0 = int(input('Qual o valor de x?'))
  9.  
  10. p = a[n]
  11. for z in range(n-1, -1, -1):
  12.     p = p * x0 + a[z]
  13.  
  14.  
  15. str_out = '%d' % p
  16.  
  17. print( str_out )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement