掃二維碼與項目經(jīng)理溝通
我們在微信上24小時期待你的聲音
解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流
創(chuàng)新互聯(lián)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) 
我們在微信上24小時期待你的聲音
解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流