Experiment 6 Programs
Experiment 6 Programs
Branch: TYCO-B
Roll-84
Experiment-6
Q. 1 Sum of Items in list
l = [10,20,20,30,40]
sum = 0
for i in l:
sum += i
print("Sum of items in list : ",sum)
Output
Sum of items in list : 120
Name: Sangram S Supalkar
Branch: TYCO-B
Roll-84
Q. 2 Multiplication of List
l = [4,5,6,3,5]
mul = 1
for i in l:
mul *= i
print("Multiplication of items in list : ",mul)
Output
Multiplication of items in list : 1800
Name: Sangram S Supalkar
Branch: TYCO-B
Roll-84
Q. 5 Reverse List
l = [23,42,4,53,6,10]
revList = []
for i in range(len(l)-1,-1,-1):
revList.append(l[i])
print("Orignal List : ",l)
print("Reversed List : ",revList)
Output
Orignal List : [23, 42, 4, 53, 6, 10]
Reversed List : [10, 6, 53, 4, 42, 23]
Name: Sangram S Supalkar
Branch: TYCO-B
Roll-84