这是我第一次使用python而且我不知道如何解决这个问题。
ItemName = 0.0
Pounds = 0.0
Ounces = 0.0
Unit_Price = 0.0
Pound_Price = 0.0
Total_Price = 0.0
ItemName = raw_input("Enter ItemName")
Pounds = int(input("Enter amount of Pounds"))
Ounces = int(input("Enter amuont of Ounces"))
Pound_Price = int(input("Enter Pound_Price"))
Unit_Price = int(input("Enter Unit_Price"))
Total_Price = Pound_Price * (Pounds + Ounces / 16)
print("Item name is: " + ItemName)
print("Your Unit price is: $" + Unit_Price)
print("Your Total Comes To: $" + Total_Price)
当我把所有东西放下来时,它给我输入错误。
答案 0 :(得分:0)
改为使用.format
:
print("Item name is: {0}".format(ItemName))
print("Your Unit price is: ${0}".format(Unit_Price))
print("Your Total Comes To: ${0}".format(Total_Price))