+ 1

Pls i need help in writing a short cmand

Iam a beginner iam trying to write a very short program. Iam trying to ask a question "what are u holding" then if i get the ans wich is "cup" it will tell me if its true or false. i did this so far help!!& x=input("what are u holding:") print (x) if n/ = cup: print("true") else: print("false")

31st Jan 2017, 8:11 PM
gerald
4 odpowiedzi
+ 4
Comment of your code mistakes, if you need to understand, in addition to right correction of @sebpincha: x=input("what are u holding:") print (x) # you output the user entry if n/ = cup: # comparison need == operator, while = is assignment operator, and 'n/' is invalid syntax for left hand operator anyway... print("true") else: print("false")
31st Jan 2017, 9:02 PM
visph
visph - avatar
+ 3
x=input("what are u holding") if x=="cup": print("true") else: print("false")
31st Jan 2017, 8:18 PM
sebipincha
sebipincha - avatar
0
thanks visph
31st Jan 2017, 9:03 PM
sebipincha
sebipincha - avatar
0
thank both of u
31st Jan 2017, 9:15 PM
gerald