美图齐众专注资阳网站设计 资阳网站制作 资阳网站建设
资阳网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

Python程序:计算五个科目的总平均值和百分比

创新互联python教程:

写一个 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)


当前题目:Python程序:计算五个科目的总平均值和百分比
当前URL:http://www.zsjierui.cn/article/dhhsopd.html

其他资讯