I wrote a simple program to calculate tax for some electrical parts, it goes like this:
print "How much does it cost?",
price = raw_input()
print "Tax: %s" % (price * 0.25)
print "Price including tax: %s" % (price * 1.25)
raw_input ("Press ENTER to exit")
And I keep getting this error:
Traceback (most recent call last):
File "moms.py", line 3, in <module>
print "Tax: %s" % (price * 0.25)
TypeError: can't multiply sequence by non-int of type 'float'
You need to convert the string that’s returned by
raw_input()to afloatfirst: