Created
December 21, 2015 21:18
-
-
Save springcoil/7ccbd1342727935c38c4 to your computer and use it in GitHub Desktop.
A simple fizzbuzz in python3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz(n): | |
| if n % 3 == 0 and n % 5 == 0: | |
| return 'FizzBuzz' | |
| elif n % 3 == 0: | |
| return 'Fizz' | |
| elif n % 5 == 0: | |
| return 'Buzz' | |
| else: | |
| return str(n) | |
| print("\n".join(fizzbuzz(n) for n in range(1, 121))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment