创新互联python教程:
成都创新互联公司是一家集网站建设,德城企业网站建设,德城品牌网站建设,网站定制,德城网站建设报价,网络营销,网络优化,德城网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
写一个 Python 程序,求两个数的平均值。这个 Python 示例接受两个整数,并计算总和和平均值。
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 程序求两个浮点数的平均值。
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
分享题目:Python 程序:计算两个数平均值
文章路径:http://www.csdahua.cn/qtweb/news6/276056.html
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网