@zachsanford/

ChoiceExample

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
userQuit = False

while userQuit == False:
  userInput = int(input('Please enter 1, 2, or 3 >> '))
  correctInput = False

  while correctInput == False:
    if userInput == 1:
      print('The value you chose was 1.')
      correctInput = True
    elif userInput == 2:
      print('The value you chose was 2.')
      correctInput = True
    elif userInput == 3:
      print('The value you chose was 3.')
      correctInput = True
    else:
      print("Hey that wasn't a choice!!!")
      userInput = int(input('Please put in a correct number >> '))
  
  userChoiceQuit = input('Would you like to try again?? (y/n) >> ')

  if userChoiceQuit == 'y':
    userQuit = False
  else:
    userQuit = True