Nested for loops and print statements

Cai Gengyang gengyangcai at gmail.com
Mon Sep 26 04:32:09 EDT 2016


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 block
>>> 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: inconsistent use of tabs and spaces in indentation
>>> for row in range(10):
	for column in range(10):
	    print("*",end=" ")

	    
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 


On Monday, September 26, 2016 at 4:16:37 PM UTC+8, Steven D'Aprano wrote:
> On Monday 26 September 2016 17:21, Jussi Piitulainen wrote:
> 
> > Cai Gengyang <gengyangcai at gmail.com> 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, or ONLY tabs, but never mixing them.
> 
> Some text editors may have a command to reindent, or clean indentation, or fix 
> indentation, or something similar.
> 
> Or you can use the tabnanny.py program:
> 
> 
> python -m tabnanny path/to/file.py
> 
> 
> 
> P.S. Hey Jussi, is the backspace key on your keyboard broken? Every time 
> somebody bottom-posts without trimming, a pixie dies...
> 
> 
> 
> -- 
> Steven
> git gets easier once you get the basic idea that branches are homeomorphic 
> endofunctors mapping submanifolds of a Hilbert space.



More information about the Python-list mailing list