-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (33 loc) · 914 Bytes
/
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
def start_game():
input_number()
check_number()
def input_number():
global number
number = int(input('Enter a number and I will tell you if it is odd or even: '))
def check_number():
global number
if number % 2 == 0:
even_output()
elif number % 1 == 0:
odd_output()
elif number == 1:
odd_output()
def even_output():
play_again = input('That number is even! Play again? (y/n): ')
if play_again == "y":
start_game()
elif play_again == "n":
exit()
else:
print('Please enter a valid entry, (y = yes, n = no)!')
check_number()
def odd_output():
play_again = input('That number is odd! Play again? (y/n): ')
if play_again == "y":
start_game()
elif play_again == "n":
exit()
else:
print('Please enter a valid entry, (y = yes, n = no)!')
check_number()
start_game()