Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hi how do i solve this ?
#2
Well, assuming your indentation is all fixed up in your actual program, I would just do this a different way:

while True:
    print("In which country is Moscow located?")
    answer1 = input("a) Russia\nb) China\nc) Japan\nd) Mongolia\nAnswer: ")
    if answer1 == "a" or answer1 == "Russia":
        print("Right Answer!")
        break
    elif answer1 != "a" or answer1 != "Russia":
        print('Incorrect!')
        break
    else:
        print('Error!')
Logic is, "if answer is a or china, print correct... if it's not a or china (anything else), print incorrect.
Reply


Messages In This Thread
Hi how do i solve this ? - by Houston222 - Feb-05-2020, 03:51 PM
RE: Hi how do i solve this ? - by t4keheart - Feb-05-2020, 04:36 PM
RE: Hi how do i solve this ? - by DeaD_EyE - Feb-05-2020, 04:42 PM
RE: Hi how do i solve this ? - by buran - Feb-05-2020, 04:51 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020