Programming Examples

Python program to create a list using for loop which consist square of the integers 1 through 50


Write a Python program to create a list using for loop which consist square of  the integers 1 through 50

Solution

mylist=list()
for a in range(1,51):
    mylist.append(a**2)
print("Result List is: ",mylist)
Output/ Explanation:

Result List is:  [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401, 2500]

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad