-1
回溯(最近通話最後一個): 文件 「E:/便攜式的Python 3.2.5.1/Tasks/Wk7」,第16行,在追溯問題:不能用非整型'float'乘以序列? [Python中3.2.5.1]
monthlySalary = hourPay * 0.1
類型錯誤:可以浮動 '
#Input hoursWorked
#Input hourPay
#Ask 「Consultancy income? (Leave blank if none)」
# If value:
# Input consultFee
# monthlySalary = ((hourPay - (hourPay * 0.1)) * hoursWorked) + (consultFee – (consultFee * 0.2))
# Elif no value:
# monthlySalary = hoursWorked * hourPay
#print (「The monthly wage is $」,monthlySalary)
hoursWorked = input ("Hours worked: ")
hourPay = input ("Hour pay: $")
consultFee = input ("Consultant fee? (Leave blank if none): $")
consultFee == ''
monthlySalary = hourPay * 0.1
'' == False
monthlySalary = ((hourPay - (hourPay * 0.1)) * hoursWorked) + (consultFee - (consultFee * 0.2))
print ("The monthly salary is: $",(int(monthlySalary)))
可能是輸入返回字符串,在乘法之前在hourPay上應用float或int函數。 – aisbaa
int(輸入(哎呀,忘記了 – JamesBaxterTheHorse