Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25002

Re: What’s the differences between these two pieces of code ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news2.arglkargh.de!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gherron@digipen.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'syntax': 0.03; 'executed': 0.07; 'referring': 0.07; 'subject:code': 0.07; 'subject:two': 0.07; 'python': 0.09; 'subject:between': 0.16; 'subject:these': 0.16; 'wrote:': 0.17; 'pieces': 0.17; 'shell': 0.18; 'python?': 0.20; 'supposed': 0.21; "i'd": 0.22; 'second': 0.24; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'to?': 0.27; 'gary': 0.29; 'prints': 0.29; 'subject: ?': 0.30; 'error': 0.30; 'code': 0.31; '(2)': 0.32; 'to:addr:python-list': 0.33; 'version': 0.34; '(1)': 0.34; 'pm,': 0.35; 'two': 0.37; 'why': 0.37; 'science': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'first': 0.61; 'between': 0.63; 'charset:windows-1252': 0.65; 'differences': 0.65; 'subject: ': 0.66; '12.': 0.71; 'dr.': 0.72; 'institute': 0.72; 'received:204': 0.72; 'subject::': 0.83; 'respectively': 0.84; 'subject:\x92': 0.84
Date Fri, 06 Jul 2012 22:41:04 -0700
From Gary Herron <gherron@digipen.edu>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: What’s the differences between these two pieces of code ?
References <48fbfc85-c495-4131-a18a-1ebb94e7ce20@googlegroups.com>
In-Reply-To <48fbfc85-c495-4131-a18a-1ebb94e7ce20@googlegroups.com>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.1883.1341640207.4697.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1341640207 news.xs4all.nl 6850 [2001:888:2000:d::a6]:41301
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25002

Show key headers only | View raw


On 07/06/2012 09:56 PM, iMath wrote:
> What’s the differences between these two  pieces of code ?
> (1)
> for i in range(1, 7):
> print(2 * i, end='   ')
>
>
> (2)
> for i in range(1, 7):
>      print(2 * i, end='   ')
> print()
>
>
> when executed both  respectively in Python shell ,I  get  the same effect . Who can tell me why  ?

What "effect" are you referring to?   What did you expect?  What did you 
get?   What version of Python?  (3 I'd guess).

As for me, the first one fails because of a syntax (indentation) error 
and the second prints the even numbers 2 through 12.  What are we 
supposed to be comparing?

Gary Herron




-- 
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What’s the differences between these two  pieces of code ? iMath <redstone-cold@163.com> - 2012-07-06 21:56 -0700
  Re: What’s the differences between these two  pieces of code ? Gary Herron <gherron@digipen.edu> - 2012-07-06 22:41 -0700
  Re: What’s the differences between these two  pieces of code ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-07 07:21 +0000

csiph-web