Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

python template provided checkout (num_hats, num tels, num_creans): This functio

ID: 3744538 • Letter: P

Question

python

template provided checkout (num_hats, num tels, num_creans): This function starts off knowing how many Headless Hats, Boxing Telescopes, and Canary Creams we would like to purchase at Weasleys' Wizard Wheezes. You can just use those three parameters to calculate. (Assume they're all non-negative numbers). The prices are two galleons per Headless Hat, 12 sickles and 26 knuts per Boxing Telescope, and seven sickles per Canary Cream. Calculate and return the total price in knuts. In the wizarding world, a galleon is worth 17 sickles, and one sickle is worth 29 knuts. o assume all three parameters (num_hats, num tels, num_creans) are non-negative integers checkout (e, e, 1) 203 checkout(e, 1, ) 374 checkout (e, 2, 748 checkout(1, 1, 1 1563

Explanation / Answer

def checkout(num_hats, num_tels, num_creams): return num_hats*2*17*29 + num_tels*(12*29+26) + num_creams*7*29 print(checkout(0, 0, 1)) print(checkout(0, 1, 0)) print(checkout(0, 2, 0)) print(checkout(1, 1, 1))