-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnumbergame.py
More file actions
31 lines (28 loc) · 865 Bytes
/
numbergame.py
File metadata and controls
31 lines (28 loc) · 865 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
25
26
27
28
29
30
31
import random
import time
dif = 100
#Change the value of dif to change the difficulty!
number = random.randint(1, dif)
score = float(1)
print("The goal of the game is to guess the number, and get the lowest score possible!")
time.sleep(1)
print("You will be told if the number you guessed is greater or lesser than the actual number!")
time.sleep(1)
print("Pick a number between 1 and ", dif, "!")
while True:
guess = float(input("Enter your guess!"))
time.sleep(1)
if guess == number:
time.sleep(1)
print("You win!")
time.sleep(1)
print("Final score: ", score)
break
if guess > number:
print("The number is lower than", guess)
score = score + 1
time.sleep(1)
if guess < number:
print("The number is greater than", guess)
score = score + 1
time.sleep(1)