Computer Science, asked by sauravkandari16, 3 months ago

A school administration wants to manage the details of students of each
class Using dictionary, dict_class. The dictionary contains roll number and
total marks of n students in a class.
a) Write the statement to display the mark of roll number 10.
b) Increase 20 marks for roll number 5.
c) Display the highest mark in the class.
d) Count the number of students who scored full marks (70 out of 70).
e) Write the statement to display the mark of roll number 5.

Answers

Answered by Equestriadash
14

The following cσdes have been written using Python.

dict_class = dict()

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

print()

for i in range(n):

   x = int(input("Enter the roll number of the student: "))

   y = float(input("Enter the total marks secured: "))

   dict_class[x] = y

   print()

print()

#statement to display the marks of roll number 10

if 10 in dict_class.keys():

   print("(a) The marks secured by roll number 10: ", str(dict_class[10]) + ".")

else:

   print("(a) No student with that number.")

print()

#increasing the marks of roll number 5 by 20

if 5 in dict_class.keys():

   dict_class[5] = dict_class[5] + 20

   print("(b) The marks have been updated.")

else:

   print("(b) No student with that number.")

print()

#displaying the highest mark in the class

print("(c)", max(dict_class.values()), "is the highest mark in the class.")

print()

#counting the number of students who scored 70/70

c = 0

for i in dict_class:

   if dict_class[i] == 70:

       c = c + 1

print("(d)", c, "student(s) have scored full marks.")

print()

#displaying the marks of roll number 5

if 5 in dict_class.keys():

   print("(e)", dict_class[5], "marks have been scored by roll number 5.")

else:

   print("(e) No student with that number.")


Equestriadash: Thanks for the Brainliest! ^_^"
Similar questions