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 ?

Date 2012-07-06 22:41 -0700
From Gary Herron <gherron@digipen.edu>
Subject Re: What’s the differences between these two pieces of code ?
References <48fbfc85-c495-4131-a18a-1ebb94e7ce20@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.1883.1341640207.4697.python-list@python.org> (permalink)

Show all headers | 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