mardi 25 août 2020

How do I get this Python code to execute properly?

The following Python code is not working and I am unsure as to why, and unsure as how to correct it. Thanks in advance!

the code should print the word “fizz” when number is a multiple of three print the word “buzz” when number is a multiple of five print the word “fizzbuzz” when number is a multiple of both three and five

for number in range(1, 100):
 message = ''
 if number % 3 != 0:
 message =+ "Fizz"
 if number % 5 != 0:
 message =+ "Buzz"
 if number % 5 == 0 or number % 3 != 0:
 number =+ str(number)
 print(message)

Aucun commentaire:

Enregistrer un commentaire