新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python程序:計算五個科目的總平均值和百分比
創(chuàng)新互聯(lián)python教程:

寫一個 Python 程序,通過一個例子找到五個科目的總平均值和百分比。
Python 程序查找五個科目的總平均值和百分比示例
這個 python 程序允許用戶為五個科目輸入五個不同的分?jǐn)?shù)。接下來, Python 找到這五個主體的總數(shù)、平均值和百分比。對于這個 python 程序,我們使用算術(shù)運算符來執(zhí)行算術(shù)運算。
# 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) 網(wǎng)站題目:Python程序:計算五個科目的總平均值和百分比
文章位置:http://m.5511xx.com/article/dhhsopd.html


咨詢
建站咨詢
