Knowee
Questions
Features
Study Tools

.Write a Python program to store marks scored in subject “Fundamental of DataStructure” by N students in the class and perform different operations.

Question

Write a Python program to store marks scored in subject Fundamental of DataStructure by N students in the class and perform different operations.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure! Here is a step-by-step guide to write a Python program to store marks scored in the subject "Fundamental of Data Structure" by N students in the class and perform different operations:

Step 1: Define the number of students (N) and create an empty dictionary to store the marks.

N = int(input("Enter the number of students: "))
marks = {}

Step 2: Use a loop to input the marks for each student and store them in the dictionary.

for i in range(N):
    name = input("Enter the name of student {}: ".format(i+1))
    score = float(input("Enter the marks scored by {}: ".format(name)))
    marks[name] = score

Step 3: Perform different operations on the marks stored in the dictionary. Here are a few examples:

  • Calculate the average marks:
total_marks = sum(marks.values())
average_marks = total_marks / N
print("Average marks: ", average_marks)
  • Find the highest and lowest marks:
highest_marks = max(marks.values())
lowest_marks = min(marks.values())
print("Highest marks: ", highest_marks)
print("Lowest marks: ", lowest_marks)
  • Search for a specific student's marks:
search_name = input("Enter the name of the student to search: ")
if search_name in marks:
    print("Marks scored by {}: ".format(search_name), marks[search_name])
else:
    print("Student not found!")

Step 4: Run the program and test it with different inputs.

Note: This is a basic example to get you started. You can add more functionality and error handling as per your requirements.

This problem has been solved

Similar Questions

Write a program to write data into binary file marks.dat anddisplay the records of students who scored more than 95marks.

# Write a function in python which accept a list of marks of students and return the# minim

If a student offered 12 subjects and the student's cumulative score is 1085. Write a program in python to show the student's average score.

Java Program To Accept the Marks of a Student and Find the Total Marks and Percentage

Write a program that displays the total students in each section.For example:Input ResultStudents.csvSectionA 2B 2C 3Name: StudentName, dtype: int64

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.