diff --git a/guide/english/python/for-loop-statements/index.md b/guide/english/python/for-loop-statements/index.md index 01a1c697a4..df11714e62 100644 --- a/guide/english/python/for-loop-statements/index.md +++ b/guide/english/python/for-loop-statements/index.md @@ -250,6 +250,30 @@ A interesting fact is that for loop is a bit faster compared to while loop in py https://stackoverflow.com/questions/869229/why-is-looping-over-range-in-python-faster-than-using-a-while-loop +**Nested Loops** + +A nested loop is a loop inside a loop. + +The "inner loop" will be executed one time for each iteration of the "outer loop": + +```python +var = ["Hey", "How"] +name = ["ram", "shyam"] + +for x in var: + for y in name: + print(x, y) +``` + +Output: +``` +> +Hey ram +Hey shyam +How ram +How shyam +> +``` #### More Information: - Python2 for loop documentation