Find and write the output of the following python code a=0 for i in range(10): a=a+1 for j in range(10): a=a+1 print(a)
please explain the working of this python code along with the output
Answers
Answered by
3
Answer:
The for loop prints the number from 1 to 10 using the range() function here i is a temporary variable which is iterating over numbers from 1 to 10. It's worth mentioning that similar to list indexing in range starts from 0 which means range( j ) will print sequence till ( j-1) hence the output doesn't include 6.
Similar questions