Q: Invalid literal for int() with base 10: '6.3' So basically what I am trying to accomplish is inputting 2 decimal point strings, multiplying them by 100 (because they're a dollar value) running them through some calculations and then outputting the result as an int/100 to give me decimal point values. I'm also using some if statements. Can anyone help me see how to avoid the error message "Can't multiply sequence by non-int of type 'str' "?
This is what I have:
sales_tax = .0735
item_cost = input ("Enter Cost of item: ")
number_items = input ("Enter Number of items: ")
item_cost = int(item_cost) * int(100)
number_items = int(number_items) * int(100)
price = int(item_cost * number_items)
price_with_tax = int(item_cost * number_items) + int(item_cost * number_items * sales_tax)
if item_cost <= 5:
print("total price is $.2f" %price)
if item_cost > 5:
print("Total price is $%.2f" %price_with_tax)


A: Integer only use integer values (duh!) and you input a decimal value. Using float() instead of int() should solve your problem.
Pd: please next time point out which line at least.
