2026fa_cse160/lecture20261117/for01/for01.py
2026-11-17 12:30:27 -05:00

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)