A Program that prints the numbers from 1 to 100
harirammanohar159 at gmail.com
harirammanohar159 at gmail.com
Mon Nov 16 06:57:04 EST 2015
On Saturday, 14 November 2015 23:04:40 UTC+5:30, Cai Gengyang wrote:
> I want to write a program in Python that does this ----
>
> "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"."
>
> How do I go about doing it ?
This would help, but try to write on your own to improve, else you cant make this going long....
i = 1
while i <= 100:
if multipleof_3 and multipleof_5:
print("FizzBuzz")
++i
elif multipleof_3:
print("Fizz")
++i
elif multipleof_5:
print("Buzz")
++i
else:
print(number)
++i
More information about the Python-list
mailing list