.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.
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.
Similar Questions
You have a class consisting of 5 students, each with a unique name and their respective marks. As the end of the semester approaches, you decide to assess the performance of your students and recognize their academic achievements.You write a Python program to categorize the students into different grades based on their marks. The program utilizes a Grade_analyzer class to represent each student and a StudentGradeAnalyzer function to analyze their grades. The function iterates through the list of students, calculates their grades and returns a dictionary containing the count of students in each grade.For grading:Students scoring between 80-100 will be in Grade A.Students scoring between 70-80 will be in Grade B.Students scoring between 60-70 will be in Grade C.Students scoring between 50-60 will be in Grade D.Students scoring below 50 will be in Grade E.Constraints:Input Format:5 lines of input, each line containing name and marks of each student.Ouptut Format:Should display items in dictionary which is holding Grades as keys and count of students falling under the grades as values.Example:Input:john 78missy 89sheldon 90mary 45meemaw 67Output:('A', 2)('B', 1)('C', 1)('D', 0)('E', 1)Explanation:input:--------Space saperated input name and marks for all the 5 students.john 78-->78 Falls into a range 70-80 so count of grade 'B' should be increased to 1.missy 89-->89 Falls into a range 80-100 so count of grade 'A' should be increased to 1.sheldon 90-->90 Falls into a range 80-100 so count of grade 'A' should be increased to 2.mary 45-->45 is less than 50 so count of grade 'E' should be increased to 1.meemaw 67-->67 Falls into a range 60-70 so count of grade 'C' should be increased to 1.
Write a program to write data into binary file marks.dat anddisplay the records of students who scored more than 95marks.
Write a C program using structure student which allows users to input details for three students including their names, roll numbers, and marks in 5 subjects. Use a function calculateTotalMarks(struct Student) which calculates the total marks and percentage for each student and displays the information. Each subject test is for 10 marks. Total marks = 50. Percentage = (marks obtained/total marks)*100.
# Write a function in python which accept a list of marks of students and return the# minimum mark, maximum mark and the average marks. Use the same function to test
You are developing a Student Record Management System in C. The system needs to store and manage information for multiple students, including their names, roll numbers, and marks obtained in different subjects. Implement array in structures to read, write, and compute average marks and the students scoring above and below the average marks for a class of N students. INPUT/OUTPUT EXAMPLE: Enter the number of students: 3 Enter details for 3 students: Student 1: Name: A Roll Number: 1 Marks in 5 subjects: Subject 1: 12 Subject 2: 13 Subject 3: 14 Subject 4: 15 Subject 5: 16 Student 2: Name: BB Roll Number: 2 Marks in 5 subjects: Subject 1: 11 Subject 2: 13 Subject 3: 12 Subject 4: 15 Subject 5: 14 Student 3: Name: CC Roll Number: 10 Marks in 5 subjects: Subject 1: 13 Subject 2: 14 Subject 3: 16 Subject 4: 17 Subject 5: 11 Class average marks: 13.73 Students scoring above average: A (Roll Number: 1) CC (Roll Number: 10) Students scoring below average: BB (Roll Number: 2)
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.