Skip to content

Instantly share code, notes, and snippets.

@timkofu
Created April 1, 2019 17:30
Show Gist options
  • Save timkofu/cdca85a777f690b6a4ae7d0873bf6096 to your computer and use it in GitHub Desktop.
Save timkofu/cdca85a777f690b6a4ae7d0873bf6096 to your computer and use it in GitHub Desktop.
class FizzBuzz:
def __init__(self):
self.current_number = 0
def detect_multiple(self):
if (self.current_number % 3 == 0) and (self.current_number % 5 == 0):
return "FizzBuzz"
elif self.current_number % 3 == 0:
return "Fizz"
elif self.current_number % 5 == 0:
return "Buzz"
else:
return self.current_number
def fizzbuzz(self):
for i in range(1,101):
self.current_number = i
print(self.detect_multiple())
FizzBuzz().fizzbuzz()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment