编写一个 Python 程序,通过示例查找五门科目的总分、平均分和百分比。
Python 程序查找五门科目的总分、平均分和百分比示例
此 Python 程序允许用户输入五门科目的五种不同分数。接下来,Python 将计算这五门科目的总分、平均分和百分比。对于此Python 程序,我们使用算术运算符来执行算术运算。
# Python Program to find Total, Average, and Percentage of Five Subjects
english = float(input("Please enter English Marks: "))
math = float(input("Please enter Math score: "))
computers = float(input("Please enter Computer Marks: "))
physics = float(input("Please enter Physics Marks: "))
chemistry = float(input("Please enter Chemistry Marks: "))
total = english + math + computers + physics + chemistry
average = total / 5
percentage = (total / 500) * 100
print("\nTotal Marks = %.2f" %total)
print("Average Marks = %.2f" %average)
print("Marks Percentage = %.2f" %percentage)
