For Loop Dilema [python-list]
Chris Angelico
rosuav at gmail.com
Sun Feb 25 15:58:58 EST 2018
On Mon, Feb 26, 2018 at 5:19 AM, <arya.kumar2494 at gmail.com> wrote:
> Why we don’t use:
>
> for _ in _ in _
>
> Instead of
>
> for _ in _:
> for _ in _:
>
> Ex:
>
> Names = ["Arya","Pupun"]
>
> for name in Names:
> for c in name:
> print(c)
>
> instead use:
>
> for c in name in Names:
> print(c)
Because programming is all about building up a program from
primitives. The number of times when we need this kind of nested loop
(with absolutely nothing in between the loops) is way too small to
justify dedicated syntax.
ChrisA
More information about the Python-list
mailing list