![]() |
HOMEWORK HELP - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: HOMEWORK HELP (/thread-13034.html) |
HOMEWORK HELP - abdullahali - Sep-24-2018 Hey guys, I have been given a list of questions to answer using this code. Ive answered some of them but some I have no answer for and would appreciate help and explaining. (a)List all of the function arguments in this program. (no answer) (b) List all of the function parameters in this program. (line 10, 22, 25, 28) © List all of the variables that are not arguments or parameters. (line 7, 18) (d) What is the scope of the folowing variables: (no answer) i. number_of_blankets ii. total iii. customer1 iv. total_before_tax (e) How many function denitions are in this program? (line 1, line 10) (f) How many function calls are in this program? (line 18?) (g) What are the values referred to by customer1 and customer2 when the program ends? (blanket_total(1,5) & blanket_total(3,4) 1 def add_tax ( subtotal ): 2 ’’’ 3 Adds 5% tax to the subtotal input 4 subtotal is the amount before tax 5 returns total the amount including tax 6 ’’’ 7 total = subtotal + 0.05* subtotal 8 return total 9 10 def blanket_total ( number_of_blankets , price_per_blanket ): 11 ’’’ 12 Computes the total amount due for the purchase of a number_of_blankets , 13 including 5% tax 14 number_of_blankets is the number of blankets purchased 15 price_per_blanket is the price for each blanket 16 returns the total for the customer 17 ’’’ 18 total_before_tax = number_of_blankets * price_per_blanket 19 return add_tax ( total_before_tax ) 20 21 # compute the total for a customer who purchases 1 blanket at $5 per blanket 22 customer1 = blanket_total (1 ,5) 23 24 # compute the total for a customer who purchases 3 blankets at $4 per blanket 25 customer2 = blanket_total (3 ,4) 26 27 # compute the total for a customer who purchases 5 blankets at $6 per blanket 28 customer3 = blanket_total (5 ,6) RE: HOMEWORK HELP - nilamo - Sep-24-2018 a) https://docs.python.org/3/tutorial/controlflow.html#defining-functions d) https://docs.python.org/3/tutorial/classes.html#python-scopes-and-namespaces |