+ 2
Help 🤷🏽♂️I don’t know whats wrong with this code
>>>> Def f(x): return (2*x)**2+(2*x)+3 >>>> num =[f(2)] if 1 ==1 print(“ f(x)=(2*x)**2+(2*x)+3\n = “) Num[0]
6 Answers
+ 3
This works (missing : on if, uppercase, and num wasn't in print.):
def f(x):
return (2*x)**2+(2*x)+3
num =[f(2)]
if 1 ==1:
print(" f(x)=(2*x)**2+(2*x)+3\n = "+str(num[0]))
+ 3
You're using Python shell?
+ 2
Yea I’m using python shell
+ 2
it converts the number into a string so it can be concatenated together with your equation string.
+ 1
If it’s python, I know for a fact def should not be capitalized but that might just be a typo here. 🤔
+ 1
What does +str mean?