1. Write a function called do_plus that accepts two parameters and adds them together with the “+” operation.
2. Add
type checking
to confirm that the type of the parameters is either an integer or a string. If the parameters aren’t good, raise a TypeError.
3. This one is a lot of work, so feel free to take it in pieces. In Chapter 4, a loop was written to make an omelet. It did everything from looking up ingredients to removing them from the fridge and making the omelet. Using this loop as a model, alter the make_omelet function by making a function called make_omelet_q3. It should change make_omelet in the following ways to get it to more closely resemble a real kitchen:
a. The fridge should be passed into the new make_omelet as its first parameter. The fridge’s type should be checked to ensure it is a dictionary.
b. Add a function to check the fridge and subtract the ingredients to be used. Call this function remove_from_fridge. This function should first check to see if enough ingredients are in the fridge to make the omelet, and only after it has checked that should it remove those items to make the omelet. Use the error type LookupError as the type of error to raise.
c. The items removed from the fridge should be placed into a dictionary and returned by the remove_from_fridge function to be assigned to a name that will be passed to make_food. After all, you don’t want to remove food if it’s not going to be used.
d. Rather than a cheese omelet, choose a different default omelet to make. Add the ingredients for this omelet to the get_omelet_ingredients function.