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

Dave Angel d at davea.name
Fri Jul 13 21:17:56 CEST 2012


On 07/07/2012 12:59 AM, redstone-cold 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  ?
>

The difference is that the first will give a syntax error, and not run.

Once you fix that, the second will print an extra blank line at the end.

-- 

DaveA



More information about the Tutor mailing list