I'm trying to write a small program that calculates the discount of a coupon and then return the total with a 6% sales tax applied. I've done some searching, but I think I'm having trouble understanding the placement of the syntax. If there's a more direct answer already posted, I'll take the link! Thanks in advance.
#Apply discount amount to item price and return with 6% sales tax
#Function to perform discount calculation
def calcDisc():
newTotal = iPrice * (iDisc / 100)
print('The new total is: ', newTotal)
return newTotal
#Function to show total with 6% sales tax
def calcDiscPlusTax():
taxTotal = newTotal * 0.6
print('The total with tax is: ', taxTotal)
#Variable for item price
iPrice = float(input('Please enter the item price: '))
#Variable for item with discount applied
iDisc = float(input('Please enter the discount amount: '))
calcDisc()
calcDiscPlusTax()
source https://stackoverflow.com/questions/74903519/python-im-not-sure-why-this-function-im-defining-isnt-working-very-fresh-t
Comments
Post a Comment