While nested Loop in python?

I = 1
while I < = 5:

result = 1
while result <= i:  
    print("*", end="")
    result += 1


print(" %d " % i)
print("")
i += 1

1. Why is the while (result) loop nested in the box whose variables start at 1 every time?

2. While the while (I) cycle only judges once at a time? That is, the cumulative value from I + = 1?

I just started to learn python. I"m a little confused here. I beg you to give me some advice. Thank you in advance.

I and result

11 < = 1
21 < = 2,2 < = 2
31 < = 3,2 < = 3,3 < = 3,
41 < = 4,2 < = 4,4 < = 4,
51 < = 5,2 < = 5,3 < = 5,4 <, 5 < = 5

Jun.16,2022

every time you enter a while loop, result is re-assigned to 1
and there is no such statement in the loop, so I will not be reassigned to 1.


your problem is that while (I) and while (result) differ in that there is no loop outside while (I) to repeat. While (I) ends after execution from 1 to 5. While while (result) executes from 1 to I, I adds 1, so it lasts until iTunes 5.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8d4d9-45e8d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8d4d9-45e8d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?