Python program to create a list of 5 numbers


Python program to create a list of 5 numbers. Numbers entered by User.

n=[]

for i in range(5):

j=int(input("Enter number: "))

n.append(j)

print("The List is", n)


Output:

Enter number: 3

Enter number: 5

Enter number: 6

Enter number: 8

Enter number: 9

The List is [3, 5, 6, 8, 9]



18 views0 comments

Recent Posts

See All

Python Program to Find Sum of Series 1²+2²+3²+….+n²

The mathematical formula to find the sum of 1²+2²+3²+….+n² is n(n+1)(2n+1)/6 So to find the sum of series we use this formula. Program: n = int(input("Enter Positive Number : ")) sum = 0 sum= (n*(n+