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
buran write Sep-18-2023, 09:48 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
