Dec-14-2021, 12:23 AM
Also, you have asked for input("") several times. You did not just get the input and store it.
Since there is no loop, the program always terminates, unless you type "quit", in which case it should complain that there is no loop for the break statement. Overall, a terrible piece of code. It does not follow the specification of what it should do. It keeps asking for strings.
input = ("") if input("").lower() == "help": print("start - to start the car") print("stop - to stop the car") print("quit - to quit") if input("").lower() != "help" print("Sorry, I don't understand that") if input("").lower() == "start": print("Car started...") if input("").lower() == "stop": print("Car stopped.") if input("").lower() == "quit": breakWhat this says is, without giving a prompt, read a string from the console. Then, discard this string and read another string from the console. If this is equal to the word "help", print out the help message. Then ask for another input string. If this is not equal to "help" (even if it is "start", "stop" or "quit"), say that you don't understand it. Then, get another string. If this third input is "start", start the car, then read another string from the console. If this is "stop", stop; iif it is "bugsbunny", ignore it without issuing any warning message, then read another string from the console. If this is "quit" then quit; otherwise do nothing.
Since there is no loop, the program always terminates, unless you type "quit", in which case it should complain that there is no loop for the break statement. Overall, a terrible piece of code. It does not follow the specification of what it should do. It keeps asking for strings.