Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
Created February 27, 2018 14:22
Show Gist options
  • Select an option

  • Save kmdsbng/39ac9cfffd3bce76108ba25f82e6bb26 to your computer and use it in GitHub Desktop.

Select an option

Save kmdsbng/39ac9cfffd3bce76108ba25f82e6bb26 to your computer and use it in GitHub Desktop.
def basic():
for i in range(1, 101, 1):
cond1 = (i % 3 == 0)
cond2 = (i % 5 == 0)
cond3 = cond1 and cond2
if cond3:
print(i, 'FizzBuzz')
elif cond2:
print(i, 'Buzz')
elif cond1:
print(i, 'Fizz')
else:
print(i)
def application():
for i in range(1, 101, 1):
cond1 = (i % 3 == 0) or (str(i).find('3') >= 0)
cond2 = (i % 5 == 0) or (str(i).find('5') >= 0)
cond3 = cond1 and cond2
if cond3:
print(i, 'FizzBuzz')
elif cond2:
print(i, 'Buzz')
elif cond1:
print(i, 'Fizz')
else:
print(i)
if __name__ == '__main__':
application()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment