0

guys help me out

Let's say you were asked the following question: 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". You would type your solution into the textbox and hit Submit when you're happy with it. You and your interviewer would then see something like this: """ x mod 3 = Fizz x mod 5 = Buzz x mod 15 = FizzBuzz else print x """ for x in range(1,101): if x % 15 == 0: print "FizzBuzz" # Catch multiples of both first. elif x % 3 == 0: print "Fizz" elif x % 5 == 0: print "Buzz" else: print x

20th Oct 2017, 7:02 PM
Walter Mugo
Walter Mugo - avatar
1 Answer
0
What exactly is wrong when the program runs? Error message?
4th Nov 2017, 6:01 PM
Connor