-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathtip3.py
More file actions
17 lines (14 loc) · 675 Bytes
/
tip3.py
File metadata and controls
17 lines (14 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# takes in an arg that's never used!
def process_student_grades(student_id, grades, course_name, instructor):
average_grade = sum(grades) / len(grades)
return f"Student {student_id} achieved an average grade of {average_grade:.2f} in {course_name}."
# better version!
def process_student_grades(student_id: int, grades: list, course_name: str) -> str:
average_grade = sum(grades) / len(grades)
return f"Student {student_id} achieved an average grade of {average_grade:.2f} in {course_name}."
# Usage
student_id = 12345
grades = [85, 90, 75, 88, 92]
course_name = "Mathematics"
result = process_student_grades(student_id, grades, course_name)
print(result)