Alice wants to buy a book that costs 129 95 An additional 13
Alice wants to buy a book that costs $129 95. An additional 13% HST will be added to the cost of the book. Calculate the amount of HST to be added (rounded to the nearest cent) and assign this value to a variable called hst. Calculate the total amount Alice will have to pay and assign it to a variable called total. Display the amount of HST calculated with a suitable message. 11) Display the total amount to be paid with a suitable message.
Solution
import math
cost = 129.95
hstTemp = 0.13 * 129.95
hst = math.ceil(hstTemp*100)/100 #For nearest cent
total = cost + hst
print \"Value of HST: \" + str(hst)
print \"Total amount to be paid by Alice: \" + str(total)
