forked from aman-raza/Friends_Hack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguess.py
More file actions
24 lines (19 loc) · 728 Bytes
/
Copy pathguess.py
File metadata and controls
24 lines (19 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# THIS IS A GUESS THE NUMBER GAME
import random
print("Hello, what is your name?")
name=input()
print("well," +name+ ",i am thinking of a number between 1 to 20.")
secretnumber=random.randint(1,20)
for guessesTaken in range(1,7):
print("Take a guess")
guess = int(input())
if guess < secretnumber:
print("Your guess is too low")
elif guess > secretnumber:
print("Your guess is too high")
else:
break
if guess == secretnumber:
print("good job,"+name+"!you guessed my number in " +str(guessesTaken)+ " guesses")
else:
print("nope. the number i was thinking of was"+str(secretnumber))