def main(): start = get_float("Enter the starting account balance: $", limit=(1,9e9)) int_rate = get_float("Enter the interest rate (from 1-100): ", limit=(1,101)) months = get_int("Enter the number of months: ", limit=(1,121)) int_rate /= 100 balance_display_loop(start, int_rate, months)
def main(): TAX_RATE = 0.0825 bill_with_tax = get_float("Enter the bill with tax: $", limit=(1, 9e9)) data = [("Tip %", "Total Due")] # table header for tip_rate in [0.100, 0.125, 0.150, 0.175, 0.200, 0.225, 0.250]: total = get_total_due(bill_with_tax, TAX_RATE, tip_rate) data += [ ( format(tip_rate * 100, '.2f'), format(total, ',.2f') ) ] print_table(data, options={'col_align': {1: '^', 2: '>'}})
def get_user_item(self, plu): name = None while name is None or len(name) == 0: name = get_str("Enter item name: ") price = get_float("Enter item price: $", \ limit=(0, self.max_price+1)) flags = '' if get_bool("Is item taxable?"): flags += 'T' if get_bool("Is this a food item?"): flags += 'F' return ItemInfo(plu, name, price, flags)
def get_user_quantity(self, name): return get_float("Enter quantity of {}: ".format(name), \ limit=(0, self.max_quantity+1))