Computer Science, asked by KeshavVyas, 1 month ago

Write a Python program to 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?​
[ please answer this question in python proper programming language, with output ] ​

Answers

Answered by nasaanirudh
59

Program:

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])  

OUTPUT:

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  

Attachments:
Answered by Ashely607S
1

Answer:

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

result = {}  

for i in range(no_of_std):  

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

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

  std_name = input("Student Name: ")  

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

  result[roll_no] = [std_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('Student's name who get more than 75 marks is/are',(result[student])

Similar questions