How Do I Print Values Of A Function For Multiple Inputs In Python?
Pyhton Code Here Completely new to programming so excuse my ignorance. Pretty clear what I was trying to do in the image attached I think. Had to give up and just rewrite the funct
Solution 1:
In Python 3, print is a function, so requires parentheses.
Use print(g(x))
instead of print g(x)
.
Solution 2:
Seems like it's working. The only change I did to your code is to rename the variable in the for loop and add the extra parens that was already mentioned.
defg(x):
return (x**7+3*x)/4
g(5)
Out[28]: 19535.0for num inrange(4,14):
print(g(num))
4099.019535.069988.5205891.0524294.01195749.02500007.54871801.08957961.015687139.0
Post a Comment for "How Do I Print Values Of A Function For Multiple Inputs In Python?"