Welcome back to this coding exercise solution, this was your first interview-grade assignment!
This is my solution to the coding exercise. Again, it may be slightly different from yours!
# Print out numbers from 1 to 100 (including 100).
# But, instead of printing multiples of 3, print "Fizz"
# Instead of printing multiples of 5, print "Buzz"
# Instead of printing multiples of both 3 and 5, print "FizzBuzz".
for n in range(1, 101):
if n % 3 == 0 and n % 5 == 0:
print('FizzBuzz')
elif n % 3 == 0:
print('Fizz')
elif n % 5 == 0:
print('Buzz')
else:
print(n)
Let me know how you got on!
Kind regards,
— Jose and the Teclado team