Today's achievement.
Python
MAX = 100
i = 1
while i <= MAX:
result = ""
if i % 3 == 0:
result += "fizz"
if i % 5 == 0:
result += "buzz"
if result == "":
result = i
print result
i += 1
I remembered the for statement.
Python
MAX = 100
for i in range(1, MAX+1):
result = ""
if i % 3 == 0:
result += "Fizz"
if i % 5 == 0:
result += "Buzz"
if result == "":
result = str(i)
print result
Recommended Posts