On 14/11/2015 17:34, 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 homework problem has been asked repeatedly over the years. Just
use your favourite search engine and there will be numerous answers.
However if you actually want to learn you'll have to try writing your
own code at some point, so see
https://docs.python.org/3/library/functions.html#func-range and
https://docs.python.org/3/library/stdtypes.html#index-14 operation "x % y".
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list