1input_string = input("Enter a list element separated by space ")
2list = input_string.split()
3print("Calculating sum of element of input list")
4sum = 0
5for num in list:
6 sum += int (num)
7print("Sum = ",sum)
8
1a = []
2s = int(input("Enter the size of array: "))
3for i in range(0, s):
4 ele = int(input("Enter the elements of the array: "))
5 a.append(ele)
6print(a)
1# Create an empty list
2Elements = list()
3
4# Iterating till the range of elements that has to be input
5for i in range(0, int(input("Enter the number of elements: "))):
6 Elements.append(input("Enter the " + str(i + 1) + " input: ")) # Adding the element to the list
7
8#Printing the list
9print(Elements)
10