File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ import random
2+ print ("Hi! what is your name?" )
3+ name = input ()
4+ secretno = random .randint (1 ,20 ) #randint generates random number [gives random number between 1 and 20 including 1n20]
5+ print ('DEBUG secret number is ' + str (secretno ))
6+ print ("well " + name , "this is a Guessing number Game" )
7+ print (name + " I am thinking of number between 1 to 20" )
8+
9+ for guessTaken in range (1 ,7 ):
10+ print ("Guess a number!" )
11+ guess = int (input ())
12+ if guess < secretno :
13+ print ("Your guess is too low" )
14+ elif guess > secretno :
15+ print ("Your guess is too high!" )
16+ else :
17+ break
18+
19+ if guess == secretno :
20+ print ("you guessed it correctly! in total " + str (guessTaken ) + " no of guesses" )
21+ else :
22+ print ("NO. the number i was thinking was " + str (secretno ))
23+
24+
25+
26+
27+
You can’t perform that action at this time.
0 commit comments