forked from Aashutoshsharma002/algo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
python-project.py
33 lines (32 loc) · 936 Bytes
/
python-project.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
27
28
29
30
31
32
33
import webbrowser
webbrowser.open("www.google.com")
def play():
import random
guessesTaken=0
print("Hello!What is your name?")
name=input()
num=random.randint(1,10)
while guessesTaken<6:
print("Take a guess.")
guess=int(input())
guessesTaken=guessesTaken+1
if guess>num:
print("Your guess is too low.")
elif guess>num:
print("Your guess is too high.")
else:
break
if guessesTaken==6:
print("out of moves")
if guess==num:
guessesTaken=str(guessesTaken)
print("Good job, "+name+" !You guessed my number in "+guessesTaken+" guesses!")
if guess !=num:
num=str(num)
print("Nope. The number i was thinking of was "+num)
again=input("play again : ")
if again=='yes':
play()
else:
exit()
Play()