我想要輸入一個數字,然后按計劃計算出幾個值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'
>>>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/278615.html
標籤:其他
上一篇:求助uic: File generated with too old version of Qt Designer (3.3)
下一篇:mod10a2
