Skip to content

Instantly share code, notes, and snippets.

@Ryanb58
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ryanb58/6ae6834f6dead891d5a6 to your computer and use it in GitHub Desktop.
Save Ryanb58/6ae6834f6dead891d5a6 to your computer and use it in GitHub Desktop.
Fizz Buzz challenge in python.
for num in range(1, 101):
if num % 3 == 0 and num % 5 == 0:
print('FizzBuzz');
elif num % 3 == 0:
print('Fizz');
elif num % 5 == 0:
print('Buzz');
else:
print(num);
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment