> How much structure would you like?
top = 100
data = {
3: "fizz",
5: "buzz"
}
for i in range(1, top+1):
output_num = True
for j in data:
if i%j == 0:
print(data[j], end="")
output_num = False
if output_num:
print(i)
else:
print("")
This is enough structure to anticipate the inevitable customer changing the requirements. No magic numbers in the real code.
Of course, I just banged this out in a web browser text editor. In PyCharm that better be wrapped in a function at minimum, or a module.
Sometimes I wonder why some dev teams take 10x longer to develop some functionality than what I would consider reasonable.
Then I see code like this.