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
1 Answer
0
If you catch 15 multiples
You donât need to check for 3âs and 5âs think it through.