Nov-18-2021, 09:04 AM
What needs to be fixed? so that the part after else works the same way as the part before it, i.e. a question is asked and an answer is given.
The second part of my question is how to loop the code after that so that when you answer "Nein" the program will restart, and when you answer "Ja" the message_J will appear. Thank you!
This is my code:
This is my output:
The second part of my question is how to loop the code after that so that when you answer "Nein" the program will restart, and when you answer "Ja" the message_J will appear. Thank you!
This is my code:
question = input('Wie heißt du?') answer = input('Bist du Frau oder Mann?') message_N = "GO AGAIN BOYS!!!" message_E = "Nein" message_J = "Too bad, lmao" message_f = f"Sehr geehrte Frau {question},\nIch grüße dich!" message_m = f"Sehr geehrter Herr {question}, \nIch grüße dich!" if question == str(): print(answer) if answer == "Mann": print(message_m) elif answer == "Frau": print(message_f) else: answer == input('Bist du jemanden anderer?') print(answer) if answer == "Ja": print(message_J) elif answer == "Nein": print(message_N)**
This is my output:
Output:C:\Users\zahar\PycharmProjects\Shrek\venv\Scripts\python.exe C:/Users/zahar/PycharmProjects/Shrek/name.py
Wie heißt du?asd
Bist du Frau oder Mann?asd
Bist du jemanden anderer?Ja
asd
Process finished with exit code 0