我正在为我的班级输入一个程序,这个问题的措辞很奇怪,但是我已经为这个问题输入了我的代码,我是否正确地将数字声明为浮点数?简单的问题,但我对其他做事方式持开放态度。
print " This program will calculate the unit price (price per oz) of store items,"
print " you will input the weight in lbs and oz, the name and cost."
item_name = (input("Please enter the name of the item. "))
item_lb_price = float(input("Please enter the price per pound of your item "))
item_lbs = float(input("please enter the pounds of your item. "))
item_oz = float(input("plese enter the ounces of your item. "))
unit_price = item_lb_price / 16
total_price = item_lb_price * (item_lbs + item_oz / 16)
print "the total price per oz is", unit_price
print "the total price for", item_name, "is a total of", total_price