+ 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")
4 Antworten
+ 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")
+ 3
x=input("what are u holding")
if x=="cup":
print("true")
else:
print("false")
0
thanks visph
0
thank both of u