新聞中心
創(chuàng)新互聯(lián)python教程:

成都創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),德城企業(yè)網(wǎng)站建設(shè),德城品牌網(wǎng)站建設(shè),網(wǎng)站定制,德城網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,德城網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
寫(xiě)一個(gè) Python 程序,求兩個(gè)數(shù)的平均值。這個(gè) Python 示例接受兩個(gè)整數(shù),并計(jì)算總和和平均值。
x = int(input("Please Enter the First Number = "))
y = int(input("Please Enter the Second number = "))
sumOfTwo = x + y
avgOfTwo = sumOfTwo / 2
flooravgofTwo = sumOfTwo // 2
print('The sum of {0} and {1} = {2}'.format(x, y, sumOfTwo))
print('The Average of {0} and {1} = {2}'.format(x, y, avgOfTwo))
print('Floor Average of {0} and {1} = {2}'.format(x, y, flooravgofTwo))Python 程序求兩個(gè)浮點(diǎn)數(shù)的平均值。
x = float(input("Please Enter the First Number = "))
y = float(input("Please Enter the Second number = "))
sumOfTwo = x + y
avgOfTwo = sumOfTwo / 2
flooravgofTwo = sumOfTwo // 2
print('The sum of {0} and {1} = {2}'.format(x, y, sumOfTwo))
print('The Average of {0} and {1} = {2}'.format(x, y, avgOfTwo))
print('Floor Average of {0} and {1} = {2}'.format(x, y, flooravgofTwo))Please Enter the First Number = 22.9
Please Enter the Second number = 14.7
The sum of 22.9 and 14.7 = 37.599999999999994
The Average of 22.9 and 14.7 = 18.799999999999997
Floor Average of 22.9 and 14.7 = 18.0 網(wǎng)站標(biāo)題:Python 程序:計(jì)算兩個(gè)數(shù)平均值
文章路徑:http://fisionsoft.com.cn/article/copgedg.html


咨詢
建站咨詢
