Someone please help me check this code, it's not printing those print functions. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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")

6th Aug 2021, 8:37 AM
Timi
Timi - avatar
3 Answers
+ 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"
6th Aug 2021, 8:42 AM
Ahmed Yasser
Ahmed Yasser - avatar
+ 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!
6th Aug 2021, 8:58 AM
Ratnapal Shende
Ratnapal Shende - avatar
0
yeah thanks it worked
6th Aug 2021, 10:36 AM
Timi
Timi - avatar