WikiJS/home/code-exercises/student-grades.md

1.3 KiB

title description published date tags editor dateCreated
Student Grades true 2025-06-27T01:26:14.561Z markdown 2025-06-27T01:26:14.561Z

Exercise: Student Grades

Concept Focus

  • Functions
  • Conditional Statements
  • Data Manipulation

Time Requirement

20-25 minutes

Difficulty Level

Medium

Problem Statement

Write a Python program that takes the following inputs:

  • Student name
  • Number of subjects (integer)
  • Scores for each subject (list of integers)

The program should then calculate and display the student's average score, as well as their grade based on the following scale:

  • 90-100: A
  • 80-89: B
  • 70-79: C
  • 60-69: D
  • Below 60: F

Example Inputs and Expected Outputs

Input

John Doe, 3, [85, 90, 78]

Output

Student Name: John Doe
Average Score: 82.67
Grade: B

Input

Jane Smith, 2, [92, 95]

Output

Student Name: Jane Smith
Average Score: 93.5
Grade: A

Instructions

  1. Write a Python program that takes the student name, number of subjects, and scores as input.
  2. Use functions to calculate the average score and determine the grade based on the provided scale.
  3. Print out the student's name, average score, and grade.

Hint

  • You can use the sum() function to calculate the total score, and then divide by the number of subjects to get the average score.