15 lines
387 B
Python
15 lines
387 B
Python
# 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)
|