-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfizzbuzzOOP.py
More file actions
41 lines (34 loc) · 936 Bytes
/
fizzbuzzOOP.py
File metadata and controls
41 lines (34 loc) · 936 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
32
33
34
35
36
37
38
39
40
41
'''
OOP Version of Game - FizzBuzz
The Players count. When they get to 3 - any multiple of 3 - they have to say "FIZZ"
And any mutliple of 5 they say "BUZZ"
If their number is a multiple of 3 And 5 the have to say "FIZZBUZZ"
'''
# imports
from time import sleep as s
# classes
class FizzBuzz:
def __init__(self):
self.range = 0
def setRange(self):
self.range = int(input('What should be the range to which is counted? '))
def play(self):
for i in range(1, self.range+1):
if i % 3 == 0 and i % 5 == 0:
print("FIZZBUZZ")
elif i % 3 == 0:
print("FIZZ")
elif i % 5 == 0:
print("BUZZ")
else:
print(i)
s(0.01)
def main(self):
self.setRange()
self.play()
# main-loop
def main():
g1 = FizzBuzz()
g1.main()
# calling main func
main()