Added lecture 2026113
This commit is contained in:
parent
be356ccb59
commit
5b630435ae
27 changed files with 738 additions and 0 deletions
15
lecture20261103/for01/for02.py
Normal file
15
lecture20261103/for01/for02.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Program to print squares of all numbers present in a list
|
||||
# https://beginnersbook.com/2018/01/python-for-loop/
|
||||
|
||||
# List of integer numbers
|
||||
numbers = [1, 2, 4, 6, 11, 20]
|
||||
|
||||
# variable to store the square of each num temporary
|
||||
sq = 0
|
||||
|
||||
# iterating over the given list
|
||||
for val in numbers:
|
||||
# calculating square of each number
|
||||
sq = val * val
|
||||
# displaying the squares
|
||||
print(sq)
|
||||
Loading…
Add table
Add a link
Reference in a new issue