|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
temp=input("输入3个数")
x,y,z=temp[0],temp[1],temp[2]
if x>y and x>z:
print(x+"最大")
elif y>x and y>z:
print(y+"最大")
else:
print(z+"最大")
这里我想将input输入的三个数放进一个temp【】里面但不知道怎么做
本帖最后由 WangJS 于 2020-4-27 16:21 编辑
试试这样
- temp = []
- print('输入一个数字按一次回车')
- for i in range(3):
- temp.append(input(''))
- print(temp)
复制代码
最终代码:
- temp = []
- print('输入一个数字按一次回车')
- for i in range(3):
- temp.append(int(input('')))
- x,y,z=temp[0],temp[1],temp[2]
- if x>y and x>z:
- print(x,"最大")
- elif y>x and y>z:
- print(y,"最大")
- else:
- print(z,"最大")
复制代码
|
|