A Program that prints the numbers from 1 to 100

Joel Goldstick joel.goldstick at gmail.com
Sat Nov 14 12:49:51 EST 2015


On Sat, Nov 14, 2015 at 12:34 PM, Cai Gengyang <gengyangcai at gmail.com>
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 ?
> --
> https://mail.python.org/mailman/listinfo/python-list
>


You could google fizzbuzz and find lots of solutions.  But, to give you a
hint, use a for loop with range to get the numbers, use if n % 3  and n % 5
to pick out 3 and 5 multiples, print accordingly
-- 
Joel Goldstick
http://joelgoldstick.com/stats/birthdays



More information about the Python-list mailing list