Python exception handling programming is used to write a program that requires the user to input the scores of 5 courses and output their average score (retaining 2 decimal places). Only legal inputs will be considered.

python

Exception handling programming

Question 7

Require

Write a program that requires the user to input the scores of 5 courses and output their average score (retaining 2 decimal places). Only legal inputs will be considered.
Tip:
The prompt string of the input function can be expressed uniformly through the slot format expression; it can be implemented using a for traversal loop.

Example

Insert image description here

code

method one

s = 0
for i in range(5)

Guess you like

Origin blog.csdn.net/m0_47161653/article/details/116206650
Recommended