docs: create home/code-exercises/student-grades
This commit is contained in:
parent
1186067d29
commit
0e812ef6cb
58
home/code-exercises/student-grades.md
Normal file
58
home/code-exercises/student-grades.md
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
title: Student Grades
|
||||
description:
|
||||
published: true
|
||||
date: 2025-06-27T01:26:14.561Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 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.
|
||||
Loading…
x
Reference in New Issue
Block a user