-4

Well this is my first time using python and I don't know how to fix this problem.

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)

when I put everything down it gives me type error.

Yugo
  • 5
  • 1
  • @Yugo Did you read the error? It says, "Cannot concatenate 'str' and 'int' objects". If that is confusing concatenate means put together (usually with a + sign), 'str' is a string such as "Item name" and int is a number. If you wanted to know what you were doing wrong, you could have just read the error. You were concatenating a string and int object, but python doesn't let you. – Nick Humrich Sep 04 '14 at 22:07

1 Answers1

0

Use .format instead:

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))
trojanfoe
  • 120,358
  • 21
  • 212
  • 242