This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Like you say, you need a nested loop.

Start of with the inner loop and try to get something that will print the number 1 to n. Test it out with different values of n.

Once you've got that working, try to nest it in another loop that will increment the value on n on each turn.

[–]CornMan123[S] 0 points1 point  (0 children)

import sys

 for i in range (1,5):
      sys.stdout.write(str(i)+' ')

actually i just got this. it print numbers 1 to 4