-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguess_game.py
37 lines (29 loc) · 930 Bytes
/
guess_game.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
import random
print("Created by Kacper Jedynak\n Github:https://github.com/ToxicPL\n Linkedin: https://www.linkedin.com/in/kacper-jedynak-a5ab91200/ ")
print("----------------------------------------")
def guess_intiger(prompt):
while True:
intiger = input(prompt)
if intiger.isnumeric:
return int(intiger)
def high_nuber(promp):
while True:
high = input(promp)
if high.isnumeric:
return int(high)
high = high_nuber("Please type a number: ")
answer: int = random.randint(1 , high)
print(answer) #TODO: Testing
print("Please guess betwen 1 and {}: ".format(high))
guess = 0
while guess != answer:
guess = guess_intiger(": ")
if guess == 0:
print("EXIT")
break
if guess == answer:
print("You got it :)")
if guess > answer:
print("Please guess lower")
elif guess < answer:
print("Please guess higher")