0
What is nested loop in Python?
4 Antworten
+ 2
Nested loop is when you have a (or more) loop inside loop of your code.
+ 2
A nested loop in Python and in any other programming language is a loop within a loop
For example:
x = 0
while x < 10:
print "I'm the outer loop!"
while x < 5:
print "I'm the inner loop!"
x++
+ 1
A nested loop is a loop within a loop, an inner loop within the body of an outer one:
for i in range(10):
print('Outer loop')
for j in range(10): #that's our nested loop
print('Inner loop')
@Timorshah In python you write every comand on a new line. And you didn't explain anything. How did you get 6 upvotes? Also, python programmers should use 'for' loops, not 'while'. Shame on you.