-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (34 loc) · 1.11 KB
/
main.py
File metadata and controls
38 lines (34 loc) · 1.11 KB
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
34
35
36
37
38
import random
Answer = random.randint(1,9)
guess = 0
tries = 0
max_tries = 5
while tries < max_tries:
guess = int(input("Guess the number(Hint: The number is a integer between 1 to 9): "))
tries += 1
if guess != Answer:
if tries == 1:
print("Try again! Your first attempt wasn't correct!")
elif tries == 2:
print("Got it wrong the 2nd time! Try again")
elif tries == 3:
print("Bad luck today! :(")
elif tries == 4:
print("Managed to get it wrong again! Be careful only last attempt left!")
else:
print("Better luck next time!")
else:
if tries == 1:
print("Got it the first time!")
elif tries == 2:
print("Got it the second time!")
elif tries == 3:
print("Got it the third time!")
elif tries == 4:
print("Got it the fourth time")
else:
print("Got it on the last try!")
break
if tries == max_tries:
print("You ran out of tries")
print("The Answer was:", Answer)