Reputation: 123
I just started a programming course the other day with none whatsoever experience in coding. I'm trying to learn Python 3 and right now I'm stuck at this problem that I just can't figure out. Not sure how to search for the right answer, since I'm not sure about all the right words in english either.
What I am trying to do is a loop with the numbers 0-99. I want the numbers to be in 10*10 rows so it would appear as they form a box, with 0 in the top left corner, and 99 in the bottom right corner. Starting with the first row being 0-9, the second row 10-19, and so on...
I have tried while loops and range and a bunch of stuff, but I just can't seem to get it to work. All help would be appreciated.
Thank you! Sincerely / Joel
Upvotes: 1
Views: 2679
Reputation: 21434
Something like this?
for row in range(0, 10):
line = ""
for col in range(0, 10):
line = line + str(row*10+col) + ", "
print(line)
Upvotes: 1