1) Print q, h, a marks in separate lines
q = [90,87,65,67,89]
h = [96,97,95,69,99]
a = [99,98,100,76,49]
marks = [q,h,a]
i = 0
while i<len(marks):
print(marks[i])
i+=1
Output:
[90, 87, 65, 67, 89]
[96, 97, 95, 69, 99]
[99, 98, 100, 76, 49]
2) Calculate the total and Percentage of q, h and a
q = [90,87,65,67,89]
h = [96,97,95,69,99]
a = [99,98,100,76,49]
mark = [q,h,a]
no = len(mark[0])
k = 1
for i in mark:
total = 0
for j in i:
total+=j
print(f'Total of sublist {k} = {total}')
print(f'Percent of sublist {k} = {(total*100)//(no*100)}%')
k+=1
3) Calculate Average of Tamil (first subject)
q = [90,87,65,67,89]
h = [96,97,95,69,99]
a = [99,98,100,76,49]
mark = [q,h,a]
total = 0
for i in mark:
total += i[0]
print(f'Average of Tamil = {total/len(mark)}')
Output:
Average of Tamil = 95.0
4) Calculate highest total among these three
q = [90,87,65,67,89]
h = [96,97,95,69,99]
a = [99,98,100,76,49]
mark = [q,h,a]
no = len(mark[0])
high = 0
k = 1
for i in mark:
total = 0
for j in i:
total+=j
if total>high:
high = total
index = k
k+=1
print(f'substring {index} is high')
Output:
substring 2 is high
Top comments (0)