nums = [1, 2, 3, 4, 5]
for n in nums: # we get item from the collection one by one
print(n)
1
2
3
4
5
Sep-Dec 2025 batch, Vikrant Patil
Date: 07 Dec 2025
Live note are here https://vikrant.dev/python-made-easy-science-math/students-module2-day3.html
Please login to https://traininghub.vikrant.dev and create a notebook with name module2-day3.ipynb
© Vikrant Patil
1
2
3
4
5
0 This
1 is
2 some
3 sentence
4 which
5 we
6 will
7 use
8 to
9 generate
10 words
0 The Zen of Python, by Tim Peters
1
2 Beautiful is better than ugly.
3 Explicit is better than implicit.
4 Simple is better than complex.
5 Complex is better than complicated.
6 Flat is better than nested.
7 Sparse is better than dense.
8 Readability counts.
9 Special cases aren't special enough to break the rules.
10 Although practicality beats purity.
11 Errors should never pass silently.
12 Unless explicitly silenced.
13 In the face of ambiguity, refuse the temptation to guess.
14 There should be one-- and preferably only one --obvious way to do it.
15 Although that way may not be obvious at first unless you're Dutch.
16 Now is better than never.
17 Although never is often better than *right* now.
18 If the implementation is hard to explain, it's a bad idea.
19 If the implementation is easy to explain, it may be a good idea.
20 Namespaces are one honking great idea -- let's do more of those!
Alice Wondegirl
Shaharukh Khan
Madhuri Dixit
Alex Lion
Alice Wondegirl
Shaharukh Khan
Madhuri Dixit
Alex Lion
1 The Zen of Python, by Tim Peters
2
3 Beautiful is better than ugly.
4 Explicit is better than implicit.
5 Simple is better than complex.
6 Complex is better than complicated.
7 Flat is better than nested.
8 Sparse is better than dense.
9 Readability counts.
10 Special cases aren't special enough to break the rules.
11 Although practicality beats purity.
12 Errors should never pass silently.
13 Unless explicitly silenced.
14 In the face of ambiguity, refuse the temptation to guess.
15 There should be one-- and preferably only one --obvious way to do it.
16 Although that way may not be obvious at first unless you're Dutch.
17 Now is better than never.
18 Although never is often better than *right* now.
19 If the implementation is hard to explain, it's a bad idea.
20 If the implementation is easy to explain, it may be a good idea.
21 Namespaces are one honking great idea -- let's do more of those!
--------------------------------------------------------------------------- StopIteration Traceback (most recent call last) Cell In[30], line 1 ----> 1 next(rprimes) StopIteration:
The Zen of Python, by Tim Peters
XXXXXXXXXXXXXXXXXXXX
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
After for loop:
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
%%file zen.txt
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!Overwriting zen.txt
problem - Write a function vector_add, which does vector addition of two vectors taken as lists - Write a function dot_product , which does dot product of two vectors given as list!
['THIS',
'IS',
'SOME',
'SENTENCE',
'WHICH',
'WE',
'WILL',
'USE',
'TO',
'GENERATE',
'WORDS']
[do(item) for item in collection]
['tail.py',
'b.pdf',
'students-module1-day4.ipynb',
'about.qmd~',
'index.qmd',
'n.html',
'say_hello.py',
'l.html',
'module2-day4.ipynb',
'topics.qmd~',
'maths_test_new.py',
'm.html',
'zen.txt',
'notes.qmd',
'_quarto.yml',
'chaos.py',
'students-module2-day2.ipynb',
'notes.qmd~',
'push',
'c.pdf',
'styles.css',
'hello.py',
'module1-day5.ipynb',
'square.py',
'trainer.qmd',
'copyzen.txt',
'maths_test.py',
'test_prog.py',
'power.py',
'promotions',
'.quarto',
'Untitled1.ipynb',
'index.qmd~',
'__pycache__',
'testargs.py',
'head.py',
'x.txt',
'a.pdf',
'_quarto.yml~',
'welcome_multi_lingual.py',
'_site',
'Untitled.ipynb',
'.gitignore',
'module2-practice.ipynb',
'students-module1-day2.ipynb',
'module1-day1.ipynb',
'module1-day2.ipynb',
'problems.ipynb',
'topics.qmd',
'module2-day3.ipynb',
'args1.py',
'cat.py',
'module2-day1.ipynb',
'trainer.qmd~',
'test_args.py',
'module1-day3.ipynb',
'chaos1.py',
'hello_person.py',
'revision.ipynb',
'Makefile~',
'helloworld.py',
'test_exception.py',
'poem.txt',
'stocks.csv',
'y.txt',
'students-module1-day3.ipynb',
'Makefile',
'.ipynb_checkpoints',
'module1-day4.ipynb',
'today.org',
'students-module2-day3.ipynb',
'z.txt']
['students-module1-day4.ipynb',
'module2-day4.ipynb',
'students-module2-day2.ipynb',
'module1-day5.ipynb',
'Untitled1.ipynb',
'Untitled.ipynb',
'module2-practice.ipynb',
'students-module1-day2.ipynb',
'module1-day1.ipynb',
'module1-day2.ipynb',
'problems.ipynb',
'module2-day3.ipynb',
'module2-day1.ipynb',
'module1-day3.ipynb',
'revision.ipynb',
'students-module1-day3.ipynb',
'module1-day4.ipynb',
'students-module2-day3.ipynb']
['tail.py',
'say_hello.py',
'maths_test_new.py',
'chaos.py',
'hello.py',
'square.py',
'maths_test.py',
'test_prog.py',
'power.py',
'testargs.py',
'head.py',
'welcome_multi_lingual.py',
'args1.py',
'cat.py',
'test_args.py',
'chaos1.py',
'hello_person.py',
'helloworld.py',
'test_exception.py']
[do(item) for item in collection if cond(item)]