救救小朋友吧,刚学python,写代码遇到问题,大佬看一眼
我想要输入一个数字,然后按计划计算出几个值a、b、c、d,然后比较abcd大小,输出最小整数,提示我无法将tuple转换为int,求大佬给建议,我写代码是这个:
num = int(input("输入:"))
if num<=6:
a = (num * 0.45 * 60),
b = (num * 0.78 * 60),
c = (num * 0.6 * 60)
d = (num * 0.4 * 60)
print (int(a),b,c,d)
else:
a = (num * 0.28 * 60),
b = (num * 0.4 * 60),
c = (num * 0.3 * 60)
d = (num * 0.15 * 60)
print (a,b,c,d)
错误提示:
Traceback (most recent call last):
File "H:\Documents\小程序项目\价格.py", line 7, in <module>
print (int(a),b,c,d)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'
>>>
num = int(input("输入:"))
if num<=6:
a = (num * 0.45 * 60),
b = (num * 0.78 * 60),
c = (num * 0.6 * 60)
d = (num * 0.4 * 60)
print (int(a),b,c,d)
else:
a = (num * 0.28 * 60),
b = (num * 0.4 * 60),
c = (num * 0.3 * 60)
d = (num * 0.15 * 60)
print (a,b,c,d)
错误提示:
Traceback (most recent call last):
File "H:\Documents\小程序项目\价格.py", line 7, in <module>
print (int(a),b,c,d)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'
>>>
...全文
相关推荐
Python儿童数字消消乐游戏源代码,小朋友认数字游戏源代码
Python儿童数字消消乐源代码,小朋友认数字游戏源代码,通过消消乐游戏的方式来让小朋友来学习数字,让孩子在玩中学数字
50行代码写扫雷-Python
用python50行代码写扫雷
Python采蘑菇的小游戏源代码,适合小朋友玩的小游戏
Python采蘑菇的小游戏源代码,适合小朋友玩的小游戏,采着毒蘑菇会躺板板哦
Python代码[简单题]
[第一次传资源]好奇!这些是我有段时间打的关于Python的一些简单的题目的代码。有些文件中有很多种解法。很适合刚学Python的人看。不过,1个资源积分应该就可以了吧。最低好像就是这个。多谢大家支持!
《python编程从入门到实践》课后习题自写代码
经典的书籍:《python编程从入门到实践》的课后习题自写代码 + 官方文档 都是很简单的题,上传下当作自己的备份吧。。。


其他
