def main(): print('Welcome to the self checkout system of Wake-Mart') scanPrices() scanCoupons(total) clubMember() makePayment(balance) payCash() payDebit() # math section/logic x = scanPrices() y = scanCoupons() total = 0 if clubMember: total = (x - y) - ((x - y) * 0.05) balance = total print('New subtotal after membership discount: ', balance) if not clubMember: total = x - y subtotal = total def scanPrices(): total = 0 price = float(input('Enter price of first item [or -1 to stop]: ')) total += price while price != -1: price = float(input('Enter price of next item[or -1 to stop]: ')) total += price if price == -1: total += 1 print('Subtotal: $',total) return total def scanCoupons(total): coupontotal = 0 coupon = float(input('Enter value of first coupon[or -1 to stop]:')) coupontotal += coupon while coupon != -1: coupon = float(input('Enter price of next coupon[or -1 to stop]:')) coupontotal += coupon if coupon == -1: coupontotal += 1 subtotal = total - coupontotal print('New subtotal: $', subtotal) return coupontotal def clubMember(): member = input('Are you a member of the Wake-Mart Club?[y/n]: ') while member != 'y' or member != 'n': member = input('Invalid input. Press y for yes, n for no: ') if member == "y": return True elif member == "n": return False def makePayment(balance): print('Payment Options:') choice = float(input('Enter 1 for cash, 2 for debit: ')) return choice def payCash(balance): print('This machine only accepts $10, $5 and $1 bills.') print('Balance: ', balance) while balance > 0: cash = float(input('Please enter 10, 5 or 1: ')) balance -= cash if cash == 10: print('$10 inserted.') print('Balance: ', balance) if cash == 5: print('$5 inserted.') print('Balance: ', balance) if cash == 1: print('$1 inserted.') print('Balance: ', balance) if balance < 0: change = -1 * balance print('Change: ', change) def payDebit(balance): card = float(input('Please enter 16-digit card number: ')) pin = float(input('Please enter 4-digit pin: ')) payment = float(input('Please enter payment amount: ')) if payment < balance: payment = float(input('Payment not high enough. Please enter payment amount: ')) if payment > balance: cashback = payment - balance print('Cash back: $', cashback) main()