write a program to input names and marks of 5 students, print the names and marks of student who got the highest marks and who got the lowest marks.

#write a program to input names and marks of 5 students, print
#the names and marks of student who got the highest marks and
#who got the lowest marks.
names=[]
marks=[]
for i in range(5):
    n=input("enter student name ")
    m=int(input("enter students marks "))
    names.append(n)
    marks.append(m)
h=max(marks)
l=min(marks)
print("highest marks are",h)
print("lowest marks are",l)
for i in range(5):
    if h==marks[i]:
        print("student having highest marks is",names[i])
    if l==marks[i]:
        print("students having lowest marks is",names[i])


Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
= RESTART: C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\list program of max and min. marks.py
enter student name rahul
enter students marks 66
enter student name ram
enter students marks 78
enter student name golu
enter students marks 45
enter student name prince
enter students marks 54
enter student name mohit
enter students marks 89
highest marks are 89
lowest marks are 45
student having lowest marks is golu
student having highest marks is mohit
>>> 

Leave a Reply

Back To Top