I found FizzBuzz by accident a week ago. So what is FizzBuzz. It is a programming task where you have to create the following:
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
So I did that, don't look yet but first read till the end.
He adapted my version into something a software developer would make. He makes a living from it for me it is just a hobby. It was fun discussing good programming with him.
one_to_hundred = []
for i in range(100):
one_to_hundred.append(i)
for i in one_to_hundred:
if i % 5 == 0 and i % 3 == 0:
one_to_hundred[int(one_to_hundred.index(i))] = "FizzBuzz"
if i % 3 == 0:
if i % 5 == 0 and i % 3 == 0:
pass
else:
one_to_hundred[int(one_to_hundred.index(i))] = "Fizz"
if i % 5 == 0:
if i % 5 == 0 and i % 3 == 0:
pass
else:
one_to_hundred[int(one_to_hundred.index(i))] = "Buzz"
print(one_to_hundred)