-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFizzBuzz3.0.py
More file actions
57 lines (44 loc) · 1.21 KB
/
Copy pathFizzBuzz3.0.py
File metadata and controls
57 lines (44 loc) · 1.21 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from sys import exit
class Number():
def __init__(self,number):
self.title = ''
if number%3 == 0:
self.title = self.title + 'Fizz'
elif number%5 == 0:
self.title = self.title + 'Buzz'
else:
self.title = number
def YN(reply):
if reply == 'Y':
print("User has accepted.")
return True
elif reply == 'N':
print("User has declined.")
return False
else:
return False
def choose_number(userReply):
try:
output = int(userReply)
except:
print("You have not typed an integer. Please try again")
return False
else:
("You have typed an integer.")
return True
while True:
notreadytoplay = True
while notreadytoplay:
print("How long would you like to play FizzBuzz?")
try:
game_length = int(input())
break
except:
print("You have not typed an integer. Please try again.")
if game_length > 0:
print(f"You will play FizzBuzz for {game_length}. Okay? Y/N")
if YN(input()):
print("dummy codeY")
else:
("You want to play for a different length.")
print("Success! For now....")