+ 1

Guys help me out?

print("which currency is widely use in trading") input("enter your answer ") x = input if x == ("USD") print ("correct") else print("wrong")

9th May 2019, 3:02 PM
Ahmed Nii Aryeetey
Ahmed Nii Aryeetey - avatar
8 Antworten
+ 4
missing colon and indentation https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2277/ read the notes in the yellow box
9th May 2019, 3:04 PM
Gordon
Gordon - avatar
+ 4
hi, i put it all together and also made a small amendment at input: print("which currency is widely use in trading") x = input("enter your answer ").upper() if x == ("USD"): print ("correct") else: print("wrong")
9th May 2019, 3:19 PM
Lothar
Lothar - avatar
+ 3
Thomas, you are absolutely right. I overlooked it. But it does work any way ;-)
9th May 2019, 4:45 PM
Lothar
Lothar - avatar
+ 2
if x=="USD" : print("correct") else : print("wrong")
9th May 2019, 3:08 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
You had the syntax for the input all wrong print("Which currency") x = input("Enter answer") if x == "USD": print("Correct") else: print("Wrong") No parentheses with if-statements, input() returns a value so you have to assign a variable while you call it and indentation was wrong Hope this helps😁
9th May 2019, 3:20 PM
Trigger
Trigger - avatar
+ 1
Thanks guys
9th May 2019, 4:56 PM
Ahmed Nii Aryeetey
Ahmed Nii Aryeetey - avatar
+ 1
Lothar Yes you did basically the same thing as me, but you also made the input uppercase. Something I didnt think of😉
9th May 2019, 4:57 PM
Trigger
Trigger - avatar
9th May 2019, 4:57 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar