0% found this document useful (0 votes)
2 views4 pages

Python Doubt

The document is a Jupyter Notebook containing Python code for managing student marks. It allows users to input student names and their corresponding marks, then identifies the student with the highest marks and lists students who scored above 80. The code includes functions for finding the highest marks and filtering students based on their scores.

Uploaded by

Souvik Roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Python Doubt

The document is a Jupyter Notebook containing Python code for managing student marks. It allows users to input student names and their corresponding marks, then identifies the student with the highest marks and lists students who scored above 80. The code includes functions for finding the highest marks and filtering students based on their scores.

Uploaded by

Souvik Roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Untitled43 - Jupyter Notebook [Link]

In [3]: # Input the number of students

n = int(input("How many students' marks you want to enter?")) #4

students = {} #empty dictionary Rahul : 90 ,

for i in range(1,n+1): #(1,5)


name = input(f"Enter the name of student {i}:")
marks = int(input(f"Enter the marks of {name}:"))
students[name]=marks # students[Rahul]=95

# Find the highest marks and the corresponding student name

highest_student = max(students,key=[Link])
highest_marks = students[highest_student]

print("\n ========================")
print(f" {highest_student} got the highest marks: {highest_marks}")
print("===================================")

How many students' marks you want to enter?4


Enter the name of student 1:Vinay
Enter the marks of Vinay:65
Enter the name of student 2:Sujoy
Enter the marks of Sujoy:87
Enter the name of student 3:Ashmita
Enter the marks of Ashmita:43
Enter the name of student 4:Prashant
Enter the marks of Prashant:93

========================
Prashant got the highest marks: 93
===================================

1 of 4 30/11/25, 10:54 pm
Untitled43 - Jupyter Notebook [Link]

In [5]: # Function to find highest marks

def find_highest(students_dict):
highest_name = ""
highest_marks = -1

for name, marks in students_dict.items():


if marks > highest_marks:
highest_marks = marks
highest_name = name

return highest_name, highest_marks

n = int(input("How many students' marks you want to enter?"))

students = {}

for i in range(1,n+1):
name = input(f"Enter the name of student {i}:")
marks = int(input(f"Enter the marks of {name}:"))
students[name]=marks

topper_name, topper_marks = find_highest(students)

print("\n ================================")
print(f" {topper_name} got the highest marks: {topper_marks}")
print("===================================")

2 of 4 30/11/25, 10:54 pm
Untitled43 - Jupyter Notebook [Link]

How many students' marks you want to enter?4


Enter the name of student 1:Vinay
Enter the marks of Vinay:87
Enter the name of student 2:Pankaj
Enter the marks of Pankaj:43
Enter the name of student 3:Rishab
Enter the marks of Rishab:65
Enter the name of student 4:Asmita
Enter the marks of Asmita:90

========================
Asmita got the highest marks: 90
===================================

3 of 4 30/11/25, 10:54 pm
Untitled43 - Jupyter Notebook [Link]

In [6]: def above_80(students_dict):


result =[]
for name, marks in students_dict.items():
if marks > 80:
[Link]((name, marks))
return result

n = int(input("How many students' marks you want to enter?"))

students = {}

for i in range(1,n+1):
name = input(f"Enter the name of student {i}:")
marks = int(input(f"Enter the marks of {name}:"))
students[name]=marks

above_80_students = above_80(students)

print("\n Students who scored above 80:")


print(above_80_students)
How many students' marks you want to enter?3
Enter the name of student 1:Sudip
Enter the marks of Sudip:45
Enter the name of student 2:Bishnu
Enter the marks of Bishnu:84
Enter the name of student 3:Ritika
Enter the marks of Ritika:79

Students who scored above 80:


[('Bishnu', 84)]

4 of 4 30/11/25, 10:54 pm

You might also like