Computer Science, asked by vcphitesh, 3 months ago

Create a dictionary with the roll number, name and marks of n students in a class and
display the names of students who have marks above 75.

Answers

Answered by ankajvaish2016
2

Vineet Midha

Answered October 12

n = int(input("Enter number of students: "))

result = {}

for i in range(n):

print("Enter Details of student No.", i+1)

rno = int(input("Roll No: "))

name = input("Name: ")

marks = int(input("Marks: "))

result[rno] = [name, marks]

print(result)

# Display names of students who have got marks more than 75

for student in result:

if result[student][1] > 75:

print(result[student][0])

'''

Execution:

Enter number of students: 5

Enter Details of student No. 1

Roll No: 1

Name: A

Marks: 90

Enter Details of student No. 2

Roll No: 2

Name: B

Marks: 70

Enter Details of student No. 3

Roll No: 3

Name: C

Marks: 70

Enter Details of student No. 4

Roll No: 4

Name: D

Marks: 80

Enter Details of student No. 5

Roll No: 5

Name: E

Marks: 33

{1: ['A', 90], 2: ['B', 70], 3: ['C', 70], 4: ['D', 80], 5: ['E', 33]}

A

D

'''

Similar questions