File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- number = 777
1+ SECRET = 777
22
33print ("In this program you will need to guess the number I am thinking of" )
4-
54print ("I am thinking of a number between 1 and 800" )
65
7- while number == 777 :
8- guess = input ()
9-
10- guess = int (guess )
11-
12- if guess < 777 :
13- print ("Your guess is too low! Please try again." )
14-
15- if guess > 777 :
16- print ("Your guess is too high! Please try again." )
17-
18- if guess == 777 :
19- print ("Well done!! Your guess is correct!" )
20-
21- break
6+ while True :
7+ try :
8+ guess = int (input ())
9+
10+ if guess < SECRET :
11+ print ("Your guess is too low! Please try again." )
12+ elif guess > SECRET :
13+ print ("Your guess is too high! Please try again." )
14+ else :
15+ print ("Well done!! Your guess is correct!" )
16+ break
17+ except ValueError :
18+ print ("Please enter a valid number." )
You can’t perform that action at this time.
0 commit comments