arr=[1,2,3]arr.reverse()print(arr)其中的123可以改成任何数 例如:用求模运算。比如说:输入234。我们要的结果是:432 1.234 % 10 = 4 2.(234 / 10 ) % 10 = 3 3.234 /100 = 2 假设上面全是int类型的。
/usr/bin/python# -*- coding:utf-8 -*-# @Time : 2018/6/14 9:30# @File : resistance.py"""计算串联和并联的电阻"""def resistance(ar1, ar2): assert ar1 > 0 and ar2 > 0, u'除非超导体,其他电阻必须大于0' if isinstance(ar1, (int, float)) and isinstan...
m = float(input("请输入铁丝的长度:"))n = float(input("请输入面积:"))高为h,宽为w=m/2-h n=h×(m/2-h)-h^2+(m/2)*h-n=0 判断是否有解 if m*m/4.0-4*n < 0:print("此问题无解!")elif m*m/4.0-4*n == 0:print("此问题一个解:")h = (-m/2+(m*...
输出要求保留1位小数,要用格式化输出 修改后的代码如下:import math x = float(input('请输入三角形的边a:')) # 边长可能为浮点数 y = float(input('请输入三角形的边b:'))z = float(input('请输入三角形的边c:'))if x>0 and y>0 and z>0 and x+y>z and x+z>y and y+z...
input_item = int(input("请输入一个数字: "))if input_item > 10:print("输入项大于 10")else:print("输入项小于 10")=== 请采纳,谢谢。