Skip to content

Instantly share code, notes, and snippets.

@mrmichaelgallen
Last active November 22, 2017 22:48
Show Gist options
  • Save mrmichaelgallen/d4a04cdade3a673f51f458b80f0873dd to your computer and use it in GitHub Desktop.
Save mrmichaelgallen/d4a04cdade3a673f51f458b80f0873dd to your computer and use it in GitHub Desktop.
FizzBuzz using Python
userInput = int(raw_input("Please enter a number greater than two: "))
userInputPlus = userInput + 1
if userInput == 0 or userInput == 1 or userInput == 2:
print("You entered " + str(userInput) + ". " + "Please enter a number greater than three.")
else:
for i in range(1, userInputPlus):
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)
if userInput > 10:
print("\n")
print("A lot fizzing and buzzing going on!")
# Title: FizzBuzz
# Language: Python 2.7.14
# Date: November 22, 2017
# Author: Michael Allen
# Version: 1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment