I dont understand simple nested loops

Joined
Aug 26, 2022
Messages
2
Reaction score
0
for num in range(10):
for i in range(num):
print (num, end=" ") #print number
# new line after each row to display pattern correctly
print("\n")

i dont understand this at all. Can someone explain this for dummies
Cheers
 
Joined
Aug 26, 2022
Messages
2
Reaction score
0
a pyramid out of numbers. Ive tried to get my head around this simple for loop logic but it takes me a long time to actually understand whats going on
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top