Skip to content

Commit 2b2b811

Browse files
authored
Merge pull request #252 from Vidyart29/master
my first hacktoberfest
2 parents 15e813e + 5a370fe commit 2b2b811

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Python/GuessNo.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+

0 commit comments

Comments
 (0)