+ 1
Someone please help me check this code, it's not printing those print functions.
command = "" while True: command= input ("> ").lower if command == "Start": print ("car started") elif command == "Stop": print ("car stopped") elif command == "Help": print (""" Start - to start the car Stop - to stop the car Quit - to finish the game """) elif command == "Quit": break else: print ("I don't understand this shit dude")
3 ответов
+ 4
you didn't call the method "lower", Call them by adding "()": .lower()
You are comparing the lowered words with first character capitalized words, "start" instead of "Start"
+ 2
as Ahmed Yasser said
str.lower() is function and not the attribute so you need to call it with () paranthesis.
command ="StArt".lower()
since you used str.lower() on input so all the characters inside command variable will be converted into lowercase.
.so now command will become :-->
command ="start"
if command =="Start":
print("Something")
this will not work because
"start" is not equal to "Start"
so you need to use all lowercase letters in if condition
if command =="start":
print("Something")
this will work!
Hope you got the point!
0
yeah thanks it worked