Re: Nested for loops and print statements

2016-09-28 Thread Larry Hudson via Python-list
On 09/27/2016 09:20 PM, Steven D'Aprano wrote: On Wednesday 28 September 2016 12:48, Larry Hudson wrote: As they came through in the newsgroup, BOTH run correctly, because both versions had leading spaces only. (I did a careful copy/paste to check this.) Copying and pasting from the news clie

Re: Nested for loops and print statements

2016-09-27 Thread Steven D'Aprano
On Wednesday 28 September 2016 12:48, Larry Hudson wrote: > As they came through in the newsgroup, BOTH run correctly, because both > versions had leading spaces only. > (I did a careful copy/paste to check this.) Copying and pasting from the news client may not be sufficient to show what whites

Re: Nested for loops and print statements

2016-09-27 Thread Larry Hudson via Python-list
On 09/26/2016 01:57 PM, Cai Gengyang wrote: Ok it works now: for row in range(10): for column in range(10): print("*",end="") but how is it different from --- for row in range

Re: Nested for loops and print statements

2016-09-27 Thread Gregory Ewing
Cai Gengyang wrote: How are you running the interactive interpreter? Are you using IDLE, or are you running Python in a command window? --- IDLE I don't normally use IDLE on MacOSX, so I had to try it to find out. I think I know what your problem is now. When you type a line into IDLE ending w

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
On Tuesday, September 27, 2016 at 2:14:05 PM UTC+8, Cai Gengyang wrote: > We're trying to help, but we need to know more about the > environment you're using to enter your code. > > What operating system are you using? --- OSX Yosemite Version 10.10.2 > > How are you running the interactive int

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
We're trying to help, but we need to know more about the environment you're using to enter your code. What operating system are you using? --- OSX Yosemite Version 10.10.2 How are you running the interactive interpreter? Are you using IDLE, or are you running Python in a command window? --- ID

Re: Nested for loops and print statements

2016-09-26 Thread Gregory Ewing
Cai Gengyang wrote: I'll still be asking for help here. Please help out a newbie. We're trying to help, but we need to know more about the environment you're using to enter your code. What operating system are you using? How are you running the interactive interpreter? Are you using IDLE, or

Re: Nested for loops and print statements

2016-09-26 Thread breamoreboy
On Monday, September 26, 2016 at 9:57:52 PM UTC+1, Cai Gengyang wrote: > Ok it works now: > > >>>for row in range(10): > for column in range(10): >print("*",end="") > > > > >

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
Sure, I just sent in a subscription request to it ... but I'll still be asking for help here. Please help out a newbie. When I master this language I can help other new users too (This is good for the world and for everyone involved). Ideally, Information and education should be free and not loc

Re: Nested for loops and print statements

2016-09-26 Thread Marko Rauhamaa
Cai Gengyang : > What is a tab and what is a space in python and what's the difference > ? > > Which piece of code is indented with tabs and which one is indented > with spaces ? Key questions that Python gurus are having a hard time answering! Equally confusing, you might run into this phantom p

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
Ok it works now: >>>for row in range(10): for column in range(10): print("*",end="") but how is it different from --- >>> for row in range(10): for column in range(10)

Re: Nested for loops and print statements

2016-09-26 Thread Terry Reedy
On 9/26/2016 12:54 PM, Cai Gengyang wrote: Which piece of code is indented with tabs and which one is indented with spaces ? I told you in my initial answer, where I said, referring to the two indented lines in one 'piece of code', "These indents are 4 spaces and 1 tabs." It is the mixture

Re: Nested for loops and print statements

2016-09-26 Thread Larry Hudson via Python-list
On 09/26/2016 08:25 AM, Cai Gengyang wrote: I just wanted to note that sometimes the code works, sometimes it doesn't. (even though both are exactly the same code) ... Weird , dum dum dum It is NOT weird. Python is being consistent, YOU are not. These examples are NOT "exactly the same code

Re: Nested for loops and print statements

2016-09-26 Thread Jussi Piitulainen
Cai Gengyang writes: > What is a tab and what is a space in python and what's the difference > ? Try print('x\tx') in Python to see a tab character between the two x's. For me it looks the same as seven spaces, for you it will also look like some amount of whitespace but it might be a different a

Re: Nested for loops and print statements

2016-09-26 Thread jmp
On 09/26/2016 06:54 PM, Cai Gengyang wrote: What is a tab and what is a space in python and what's the difference ? Which piece of code is indented with tabs and which one is indented with spaces ? Please do not top-post in this list. Put your text after the message you quote. Tabs and sp

Re: Nested for loops and print statements

2016-09-26 Thread Steve D'Aprano
On Tue, 27 Sep 2016 01:25 am, Cai Gengyang wrote: > I just wanted to note that sometimes the code works, sometimes it doesn't. > (even though both are exactly the same code) ... Weird , dum dum dum They are not the same code. One of them mixes tabs and spaces for the same indent level, the other

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
What is a tab and what is a space in python and what's the difference ? Which piece of code is indented with tabs and which one is indented with spaces ? On Tuesday, September 27, 2016 at 12:40:16 AM UTC+8, MRAB wrote: > On 2016-09-26 16:25, Cai Gengyang wrote: > > I just wanted to note that

Re: Nested for loops and print statements

2016-09-26 Thread MRAB
On 2016-09-26 16:25, Cai Gengyang wrote: I just wanted to note that sometimes the code works, sometimes it doesn't. (even though both are exactly the same code) ... Weird , dum dum dum for row in range(10): for column in range(10): print("*",end="") SyntaxError: inco

Re: Nested for loops and print statements

2016-09-26 Thread jmp
On 09/26/2016 05:25 PM, Cai Gengyang wrote: I just wanted to note that sometimes the code works, sometimes it doesn't. (even though both are exactly the same code) ... Weird , dum dum dum for row in range(10): for column in range(10): print("*",end="") SyntaxError:

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
I just wanted to note that sometimes the code works, sometimes it doesn't. (even though both are exactly the same code) ... Weird , dum dum dum >>> for row in range(10): for column in range(10): print("*",end="") SyntaxError: inconsistent use of tabs and spaces in inde

Re: Nested for loops and print statements

2016-09-26 Thread Steven D'Aprano
On Monday 26 September 2016 18:32, Cai Gengyang wrote: > These are my attempts --- That's nice. Do you have a question? > SyntaxError: inconsistent use of tabs and spaces in indentation When you indent, press TAB or SPACE but not both. This error can only happen if you are use spaces for some

Re: Nested for loops and print statements

2016-09-26 Thread Jussi Piitulainen
Cai Gengyang writes: > These are my attempts --- > for row in range(10): > for column in range(10): > print("*",end=" ") > > SyntaxError: inconsistent use of tabs and spaces in indentation What do you type yourself? Could it be that your software starts the second line with

Re: Nested for loops and print statements

2016-09-26 Thread Jussi Piitulainen
Steven D'Aprano writes: > P.S. Hey Jussi, is the backspace key on your keyboard broken? Every > time somebody bottom-posts without trimming, a pixie dies... I was annoyed by the top-posted one-liner in response to the last line of Terry's response. I responded in kind and then it was too late. I'

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
These are my attempts --- >>> for row in range(10): for column in range(10): print("*",end=" ") SyntaxError: inconsistent use of tabs and spaces in indentation >>> for row in range(10): for column in range(10): print("*",end=" ") SyntaxError: expected an indented

Re: Nested for loops and print statements

2016-09-26 Thread Steven D'Aprano
On Monday 26 September 2016 17:21, Jussi Piitulainen wrote: > Cai Gengyang writes: [snip 80 or so lines] > Reindent your lines. In case Cai doesn't know what "reindent" means: It depends on your text editor. At worst, you have to delete all the indents, and re-enter them, using ONLY spaces, o

Re: Nested for loops and print statements

2016-09-26 Thread Jussi Piitulainen
Cai Gengyang writes: > So what do i need to do to correct the error ? > > Regards > > > On Monday, September 26, 2016 at 2:48:16 PM UTC+8, Terry Reedy wrote: >> On 9/26/2016 1:59 AM, Cai Gengyang wrote: >> > Why is it that you need a print() at the end to create the table for >> > example 1: >>

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
So what do i need to do to correct the error ? Regards On Monday, September 26, 2016 at 2:48:16 PM UTC+8, Terry Reedy wrote: > On 9/26/2016 1:59 AM, Cai Gengyang wrote: > > Why is it that you need a print() at the end to create the table for > > example 1: > > > > Example 1 --- > > > for r

Re: Nested for loops and print statements

2016-09-25 Thread Terry Reedy
On 9/26/2016 1:59 AM, Cai Gengyang wrote: Why is it that you need a print() at the end to create the table for example 1: Example 1 --- for row in range(10): for column in range(10): print("*",end=" ") # Print a blank line for next row print() These indents are either 4

Re: Nested for loops and print statements

2016-09-25 Thread Jussi Piitulainen
Cai Gengyang writes: > Why is it that you need a print() at the end to create the table for > example 1: > > Example 1 --- > for row in range(10): > for column in range(10): > print("*",end=" ") > > # Print a blank line for next row > print() [- -] > When I try to do e

Nested for loops and print statements

2016-09-25 Thread Cai Gengyang
Why is it that you need a print() at the end to create the table for example 1: Example 1 --- >>> for row in range(10): for column in range(10): print("*",end=" ") # Print a blank line for next row print() * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *