Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42996
| Path | csiph.com!usenet.pasdenom.info!news.franciliens.net!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'algorithm': 0.04; 'exercise': 0.04; 'newbie': 0.05; 'output': 0.05; 'needed,': 0.07; 'odd': 0.07; 'squares': 0.07; 'function,': 0.09; 'subject:question': 0.10; 'python': 0.11; 'code?': 0.16; 'does,': 0.16; 'likewise': 0.16; 'squared': 0.16; 'subject:python.': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'trying': 0.19; 'comfortable': 0.22; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'simpler': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'code': 0.31; 'ahead.': 0.31; 'piece': 0.31; 'probably': 0.32; "i'd": 0.34; 'problem': 0.35; 'something': 0.35; 'yield': 0.36; 'example,': 0.37; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'number,': 0.60; 'new': 0.61; 'numbers': 0.61; 'simple': 0.61; "you're": 0.61; "you've": 0.63; 'making': 0.63; 'sum': 0.64; 'subject:. ': 0.67; 'realized': 0.68; 'received:74.208': 0.68; 'stated': 0.69; '165': 0.84; 'algorithm,': 0.84; 'received:74.208.4.194': 0.84; 'subject:Very': 0.84; 'working,': 0.84 |
| Date | Sun, 07 Apr 2013 07:50:29 -0400 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Newbie to python. Very newbie question |
| References | <f0759987-4ff8-49a1-a826-4ae3f6508030@5g2000yqz.googlegroups.com> |
| In-Reply-To | <f0759987-4ff8-49a1-a826-4ae3f6508030@5g2000yqz.googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:FJONp1Kv3bDC+KJ1x6jDOUFSJZWxYLWk2FfDSOCcteR FUnoFb0e5YLONZC+nE6xdaDtn5RzHydYt9BG9lKM+MtyADiSSD 9E0axFdr24MtNRHBMZ0eqKxa2i26Vd7QK30USh96EGHYMjZnVi 3XG4N0N0m/DNU1OIgS8bZAJZ+fvE2m3ZhZ06x+IzMDbFrKVOoE pcq+vh2YMTFVKKXY6dVtsBgI3QHwsNb3Ks6ocD5tCvKgSHPItn vU2nZhAb1z98fPx9nLOi2vsm2GLZ4Bj1Wz2WPbMLtk9oGa33Hg Qu7ZwS9IBrzMw4n/AwKteI+9jZd4IvLEQHOM+tcdGfVOdzQ0A= = |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.239.1365335449.3114.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365335449 news.xs4all.nl 6857 [2001:888:2000:d::a6]:46405 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:42996 |
Show key headers only | View raw
On 04/07/2013 07:16 AM, ReviewBoard User wrote: > Hi > I am a newbie to python Then why are you trying to do 7 or 8 things on one line? > and am trying to write a program that does a > sum of squares of numbers whose squares are odd. > For example, for x from 1 to 100, it generates 165 as an output (sum > of 1,9,25,49,81) > No it doesn't. A small piece of it does, and I'd recommend making that piece a separate line or three, probably making a function out of it. Then if you want to write other code to exercise that function, go right ahead. If you're new to Python, concentrate on the algorithm needed, and keep the program straightforward. After you've got something simple working, and you're comfortable with the algorithm, then you can play code-golf to your heart's content. Perhaps you hadn't realized that any odd number when squared will yield an odd number, and likewise for even. So the stated problem is much simpler than what you're trying to do. 3 lambda's in one line of code? Silly. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Newbie to python. Very newbie question ReviewBoard User <lalitha.viswanath@gmail.com> - 2013-04-07 04:16 -0700
Re: Newbie to python. Very newbie question Kruno Saho <kruno.saho@gmail.com> - 2013-04-07 04:19 -0700
Re: Newbie to python. Very newbie question Dave Angel <davea@davea.name> - 2013-04-07 07:50 -0400
Re: Newbie to python. Very newbie question rusi <rustompmody@gmail.com> - 2013-04-07 10:02 -0700
Re: Newbie to python. Very newbie question Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-07 10:04 -0700
Re: Newbie to python. Very newbie question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-04-07 15:09 -0400
Re: Newbie to python. Very newbie question Miki Tebeka <miki.tebeka@gmail.com> - 2013-04-07 16:57 -0700
Re: Newbie to python. Very newbie question Ian Foote <ian@feete.org> - 2013-04-07 20:23 +0100
Re: Newbie to python. Very newbie question Arnaud Delobelle <arnodel@gmail.com> - 2013-04-07 21:16 +0100
Re: Newbie to python. Very newbie question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-08 03:16 +0000
csiph-web