repl.it
@Str0b3/

Guess The Number

Python

No description

fork
loading
Files
  • main.py
main.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
34
35
36
37
38
39
40
41
import time
import random
x=0
y=0
z=0
w=0
a=random.randint(1,20)
time.sleep(0.5)
n=input("Tell me your name, please. >>> ")
time.sleep(0.5)
print("Hello, " + n + ". I challenge you to play Guess the Number.")
time.sleep(3)
print("I have chosen an integer from 1 to 20. Guess it in 6 tries or less, and you win.")
time.sleep(4)
while y<6:
	y=y+1
	if y>1:
		if x>a:
			print("Your guess is higher than the correct number.")
		else:
			print("Your guess is lower than the correct number.")
		time.sleep(3)
		x=int(input("Guess the number. >>> "))
		if x==a:
			w=1
			break
	else:
		x=int(input("Guess the number. >>> "))
		if x==a:
			w=1
			break
if w==1:
	print("You win! You guessed the number, " + str(a) + ", in " + str(y) + " tries.")
	time.sleep(3)
	print("You did well...")
	time.sleep(3)
else:
	print("You lose. The number was " + str(a) + ".")
	time.sleep(3)
	print("Better luck next time, " + n + "...")
	time.sleep(3)
Fetching token
?