Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98824
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: A Program that prints the numbers from 1 to 100 |
| Date | 2015-11-14 12:49 -0500 |
| Message-ID | <mailman.336.1447523394.16136.python-list@python.org> (permalink) |
| References | <ddada022-49a4-418e-85a1-45cd6da015f7@googlegroups.com> |
On Sat, Nov 14, 2015 at 12:34 PM, Cai Gengyang <gengyangcai@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A Program that prints the numbers from 1 to 100 Cai Gengyang <gengyangcai@gmail.com> - 2015-11-14 09:34 -0800
Re: A Program that prints the numbers from 1 to 100 Joel Goldstick <joel.goldstick@gmail.com> - 2015-11-14 12:49 -0500
Re: A Program that prints the numbers from 1 to 100 BartC <bc@freeuk.com> - 2015-11-14 18:18 +0000
Re: A Program that prints the numbers from 1 to 100 Ammammata <ammammata@tiscalinet.it> - 2015-11-16 11:12 +0000
Re: A Program that prints the numbers from 1 to 100 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-14 18:25 +0000
Re: A Program that prints the numbers from 1 to 100 Steven D'Aprano <steve@pearwood.info> - 2015-11-15 12:39 +1100
Re: A Program that prints the numbers from 1 to 100 harirammanohar159@gmail.com - 2015-11-16 03:57 -0800
Re: A Program that prints the numbers from 1 to 100 Chris Angelico <rosuav@gmail.com> - 2015-11-16 23:35 +1100
Re: A Program that prints the numbers from 1 to 100 Jussi Piitulainen <harvesting@is.invalid> - 2015-11-16 15:39 +0200
Re: A Program that prints the numbers from 1 to 100 Chris Angelico <rosuav@gmail.com> - 2015-11-17 00:43 +1100
csiph-web