Sep-18-2023, 09:25 AM
Dear Friend,
I am a beginner in python.
I find it hard to understand the logic of the following issues:
1- why we use empty string?
2-Why when you right "start" for the second time you get "car already-started"
Your help will be appreciated.
Note: It is a code for a game. the code is long but I have selected the section that I did not understand.
I am a beginner in python.
I find it hard to understand the logic of the following issues:
1- why we use empty string?
2-Why when you right "start" for the second time you get "car already-started"
Your help will be appreciated.
Note: It is a code for a game. the code is long but I have selected the section that I did not understand.
command = "" already_started = False while command != "quit": command = input(">").lower() if command == "start": if already_started: print("car already started") else: already_started = True print("car already started") print("car started")
Output:>start
car started
>start
car already started