创新互联python教程:
创新互联专注于昆山企业网站建设,成都响应式网站建设公司,成都做商城网站。昆山网站建设公司,为昆山等地区提供建站服务。全流程按需设计网站,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务
写一个 Python 程序来减去两个数字。
num1 = 128
num2 = 256
sub = num1 - num2
print('The Result of subtracting {0} from {1} = {2}'.format(num2,num1,sub))
The Result of subtracting 256 from 128 = -128
这个 Python 程序接受两个整数值,并从另一个数中减去一个数。
num1 = int(input("Please Enter the First Number = "))
num2 = int(input("Please Enter the second number = "))
sub = num1 - num2
print('The Result of subtracting {0} from {1} = {2}'.format(num2,num1,sub))
其他产出很少
Please Enter the First Number = 11
Please Enter the second number = 43
The Result of subtracting 43 from 11 = -32
Please Enter the First Number = 99
Please Enter the second number = 23
The Result of subtracting 23 from 99 = 76
Python 编程使用函数减去两个数。
def subtractTwoNum(a, b):
return a - b
num1 = int(input("Please Enter the First Number = "))
num2 = int(input("Please Enter the second number = "))
sub = subtractTwoNum(num1, num2)
print('The Result of subtracting {0} from {1} = {2}'.format(num2,num1,sub))
Please Enter the First Number = 12
Please Enter the second number = 49
The Result of subtracting 49 from 12 = -37
Please Enter the First Number = 70
Please Enter the second number = 37
The Result of subtracting 37 from 70 = 33
网站名称:Python程序:两个数相减
网站网址:http://www.shufengxianlan.com/qtweb/news46/48446.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联