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

Gary Herron gherron at digipen.edu
Sat Jul 7 01:41:04 EDT 2012


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





More information about the Python-list mailing list