0

My 12 year old is starting to learn Python. He is trying to write a rows and columns using 2 for loops. This is the code he wrote so far.

for rows in range(1, 6, 1):
print('something')
for col in range(1, 6, 1):
    print(str(col))

The desired output is as follows:

1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
miradulo
  • 28,857
  • 6
  • 80
  • 93
sutterhome1971
  • 380
  • 1
  • 9
  • 22
  • Where does the data come from? List? List of lists? You can suppress `print`'s automatic line break with the `end` parameter (`print("no linebreak pls", end="")`) – Jasper Jun 05 '16 at 18:58
  • awesome!!! it works thanks much – sutterhome1971 Jun 05 '16 at 19:04
  • 1
    Possible duplicate of [python 3: print new output on same line](http://stackoverflow.com/questions/12032214/python-3-print-new-output-on-same-line) – miradulo Jun 05 '16 at 19:10

0 Answers0