You are a new intern at Hunter's Gym near Baruch College. Hunter needs a simple backend system to register members, assign gym fobs, and check whether a member can enter.
The gym has 10,000 fobs numbered 1 to 10000. A fob can only be assigned to one active member record at a time.
Use Python dictionaries as the data store: dictionary keys should make lookup fast, and dictionary values should hold the related member or fob information.
Guide · 1 of 4
A Python function is a reusable mini-process. You give it inputs, it follows steps, and it can return an output. Excel formulas work the same way: a formula such as =SUM(A1:A5) takes input cells, follows a rule, and returns an answer.
In this example, base_fee and tax are inputs, the indented lines are the steps, and return total gives back the output. As you work on Q1, think of create_gym_state() as a formula that builds the starting workbook for the gym: it creates the dictionaries the rest of the program will use.
Guide question: In your own words, how is a Python function similar to an Excel formula? Think about inputs, steps, and outputs.