Skip to content

Instantly share code, notes, and snippets.

@ltagliaferri
Last active June 1, 2016 04:36
Show Gist options
  • Save ltagliaferri/a750930fb47a94e203166744678ab98a to your computer and use it in GitHub Desktop.
Save ltagliaferri/a750930fb47a94e203166744678ab98a to your computer and use it in GitHub Desktop.
# Define x
x = 0
# Define for-loop that starts with x and uses the range function to go from 1 to 100
for x in range(1,101):
# Print out "FizzBuzz" if a number in the range is divisible by 3 AND 5
if x%3 == 0 and x%5 == 0:
print("FizzBuzz")
# Print out "Fizz" if a number in the range is divisible by 3
elif x%3 == 0:
print("Fizz")
# Print out "Buzz" if a number in the range is divisible by 5
elif x%5 == 0:
print("Buzz")
# Print out every other number in the range as the number itself
else:
print(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment