Nested for loops and print statements
Cai Gengyang
gengyangcai at gmail.com
Mon Sep 26 01:59:38 EDT 2016
More information about the Python-list mailing list
Mon Sep 26 01:59:38 EDT 2016
- Previous message (by thread): Dynamically updating Graph in python
- Next message (by thread): Nested for loops and print statements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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()
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
but not for Example 2 ---
for row in range(10):
print("*",end=" ")
* * * * * * * * * *
When I try to do example 1 without the print() statement at the end, I get this error :
for row in range(10):
for column in range(10):
print("*",end=" ")
SyntaxError: inconsistent use of tabs and spaces in indentation
- Previous message (by thread): Dynamically updating Graph in python
- Next message (by thread): Nested for loops and print statements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list