Python choice input example
Simple example code. “Do you want to: A) Approach the house. B) Approach the stable. [A/B]?” and stop when you enter
Q. It would be up to you to continue this structure of code with more logic to suit your desired implementation.
while True: d1a = input("Do you want to: \n A) Approach the house. B) Approach the stable. [A/B]? : ") if d1a == "A": print("You approach the cottage.") elif d1a == "B": print("You approach the stables.") elif d1a == "Q": print("Nothing.") break
Note: Writing in this style will get difficult and complex. So split up code into functions, modules, etc.
Do comment if you have any doubts and suggestions on this Python input program.
Note: IDE: PyCharm 2021.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.