Die heutige Leistung.
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
Ich erinnerte mich an die for-Anweisung.
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