-
Notifications
You must be signed in to change notification settings - Fork 0
/
03.03.2019_randomNumberGuessingGame.py
42 lines (30 loc) · 1.12 KB
/
03.03.2019_randomNumberGuessingGame.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
42
#ToniP
#INF103
#randomNumberGuessingGame
#generates a random number in the range of 1-100
import random
def rando(number):
num = random.randint(1,3)
return num
randomNum = random.randint(1,5)
def main():
#asks the user to guess the number
print("I'm thinking of a number from 1 to 100...")
guess = int(input('Guess a number from 1 - 100: '))
#if the users guess is high display the number is too high guess again
#if guess is to low, print number is to low
while guess == randomNum:
rando(guess)
guess = int(input('Guess a number from 1 - 100: '))
while guess != randomNum:
if randomNum < guess:
print('Guess is to high, please guess again')
guess = int(input('Guess a number from 1 - 100: '))
elif randomNum > guess:
print( 'Guess is to low, please guess again')
guess = int(input('Guess a number from 1 - 100: '))
if randomNum == guess:
print( 'got it')
#congradulate user and generate a new random number
#return main
main()