Python Forum
4 tries choice question, one difficulty
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
4 tries choice question, one difficulty
#5
Thanks for all the replies. Appreciate it. I've managed to solve it

rainbow = ("red", "orange", "yellow", "green", "blue", "indigo", "violet")
tries = 0

go = True
while go:
    choice = input("Enter rainbow colour: ")
    if choice in rainbow:
        print("Correct")
        go = False
    else:
        tries += 1
        if tries == 4:
            print("Out of tries")
            go = False
        else:
            print("Try again")
Reply


Messages In This Thread
RE: 4 tries choice question, one difficulty - by extricate - Jun-04-2020, 05:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Difficulty when trying to call all the input values extricate 2 2,042 Jun-05-2020, 09:36 AM
Last Post: pyzyx3qwerty
  Writing python function difficulty kirito85 5 3,437 Oct-28-2018, 07:34 AM
Last Post: buran
  Increasing difficulty of a maths game Maxxy_Gray 1 3,307 Apr-04-2018, 03:00 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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