Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98824
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: A Program that prints the numbers from 1 to 100 |
| Date | Sat, 14 Nov 2015 12:49:51 -0500 |
| Lines | 22 |
| Message-ID | <mailman.336.1447523394.16136.python-list@python.org> (permalink) |
| References | <ddada022-49a4-418e-85a1-45cd6da015f7@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de gXtTpnY1sv/bL6ZJFW5FggeAoWC8r+g0rDBRZYC8B0TA== |
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'received:209.85.223': 0.03; 'cc:addr:python-list': 0.09; 'python': 0.10; '"write': 0.16; 'accordingly': 0.16; 'multiples': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'email addr:gmail.com>': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; '----': 0.27; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'prints': 0.29; 'subject:numbers': 0.29; 'subject:that': 0.29; 'print': 0.30; 'url:mailman': 0.30; 'solutions.': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'could': 0.35; 'nov': 0.35; 'but': 0.36; 'instead': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'doing': 0.38; 'received:209': 0.38; 'google': 0.39; 'does': 0.39; 'subject:from': 0.39; 'subject:the': 0.39; 'url:mail': 0.40; '\xc2\xa0and': 0.84; 'to:none': 0.91; 'joel': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=SHb7mmZ5bbea7i4YIQzm59JQilLGBIwFWIKzf/ghNMs=; b=Ly0VlVPAy+anOGJNeIe4PXSK/IrzAlC8IBjnO8MDI/XK2dZ+yaoJJrPAN66gmo7pGn 8qEH2E5XI+JGwP7mGszRKeDL76qLRvN1tFbCngI3hKYPy8dnv05/rS77mF7oRWXqsMfr 5S6lSjt1CPj+mnTJlOc6lVnDOpdb1YakTNWJ7ad/5EORCsSnZ9K83drPCLTXyAt9C9ib E9hJs6WkjwbgKrWN0h/zKAVsGom1hP7arcUZrytebaYW+YRXERmOS73GPHvExe7UYaNz iwvv77G0iGWSxHPpYCkSLl5jeEjd4j0sbaKhQv1+Bft/WumZkBmVcPE2v4yTfhDehRw3 h3QQ== |
| X-Received | by 10.107.30.80 with SMTP id e77mr24113619ioe.180.1447523391530; Sat, 14 Nov 2015 09:49:51 -0800 (PST) |
| In-Reply-To | <ddada022-49a4-418e-85a1-45cd6da015f7@googlegroups.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:98824 |
Show key headers only | View raw
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