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

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Jul 13 23:23:02 CEST 2012


On 13/07/2012 18:54, Chris Hare wrote:
>
> On Jul 6, 2012, at 11:59 PM, 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()
>>
> I think they are exactly the same, except the second example will print an extra "blank" line before exiting

Wrong see Dave Angel's reply, remember that indentation counts in Python :-)

>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-- 
Cheers.

Mark Lawrence.





More information about the Tutor mailing list