[Tutor] What’s the differences between these two pieces of code ?
Alan Gauld
alan.gauld at btinternet.com
Mon Jul 16 01:39:39 CEST 2012
On 07/07/12 05:59, redstone-cold wrote:
> What’s the differences between these two pieces of code ?
Apart from the obvious extra print statement its hard to tell
because your message is showing up with different indent levels.
In my mail reader both loops were indented, in my quoted reply
neither is... Others seem to see one indented but not the other.
Please stick to plain text in mails containing Python code.
I know that seems to be hard in some mail clients but it
really helps when Python code is involved.
> (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 .
What do you mean by the Python Shell?
Are you running a vanilla interpreter within a console or some form of
IDE? Some IDEs swallow characters making it harder to tell exactly what
is going on.
If it is a native prompt which OS are you using? That too can make a
difference.
> Who can tell me why?
Once we know what you are typing and which environment you are using we
probably can explain whatever you are seeing...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list