Luke Graham

LAMP Stack Developer

  • Home
  • Who am I?
  • Sample Works
  • Resume
  • Social Media

More Carson’s Homework

March 22, 2019 by Luke Graham

Just copypastaing this here, have no idea what it does or why I wrote it and I’m not wasting time reading it. Enjoy.

cont = True
global_cost = 0
local_cost = 0

while cont:  # simplified from while cont == True, same action
    number_of_registers = float(input('How many people are you registering?')) # simplified from two lines into one combined float/input form
    if number_of_registers <= 3:
        local_cost = number_of_registers * 150
        global_cost = global_cost + local_cost
    elif number_of_registers <= 9:
        local_cost = number_of_registers * 100
        global_cost = global_cost + local_cost
    else:
        local_cost = number_of_registers * 90
        global_cost = global_cost + local_cost

    print('The cost for this group will be ', local_cost)
    print('The cost for the total transaction will be ', global_cost)

    cont_str = input('Would you like to c ontinue?')
    if cont_str == 'Yes' or cont_str =='yes':
        cont = True
        print('')  # spacing to make code beautiful
    else:
        cont = False

Filed Under: Python Scripts

© 2022 · Luke Graham · Powered by Imagely