Ah true, here's that solution if anybody wants it:
#Go from 0 to 100
for n in range(1,101):
#Create an empty string to store output
output = ""
#Add Fizz to the output if number is divisible by 3
if not (n%3):
output += "Fizz"
#Add Buzz to the output if number is divisible by 3
if not (n%5):
output += "Buzz"
#Print output if input was divisible by 3 or 5 otherwise print input
print output or str(n)
View all comments
Show parent comment
3
u/acfman17 Jan 17 '14
Ah true, here's that solution if anybody wants it: