Python Script to Calculate Student Average Grade
This Snippet is coded by a user inOnline python Compiler. You can see and run this code too.
زبان: python
This Python code is a simple student grade average calculator. It defines a list of school subjects and then uses a loop to prompt the user for each subject's grade. The entered grade must be between 0 and 20; otherwise, an error message is shown. Grades are stored in a dictionary. Then the sum of grades is calculated and divided by the number of subjects to obtain the average. Finally, the average is printed with a Persian message.
Educational points:
- Using lists and for loops
- Taking input and converting to float
- Input validation with while
- Storing data in a dictionary
- Simple mathematical calculations
To run it, just execute the code in a Python environment and enter the grades.