Discount Price Calculator – Q&A

Question 1[10 marks]
Oksana has created the following program in her computer science lesson. The aim of this program is to calculate the price after discount of a list of products bought by a customer.

Here is her Python code:
To help Oksana use the right terminology when annotating and explaining what her code does, you will need to answer the following 10 questions:

  1. What is the identifier of the subroutine defined in this code?
  2. Is this subroutine a procedure or a function? Why?
  3. How many parameters does this subroutine take?
  4. What programming construct is this subroutine based on: sequencing, selection or iteration?
  5. Which line of code will be executed first by the computer when you run this code?
  6. What programming construct is the main program based on: sequencing, selection or iteration?
  7. Can you identify three variables used in the main program?
  8. What is the data type of item?
  9. What is the data type of discount?
  10. On which line of code is string concatenation used?
1) 
2) 
3) 
4) 
5) 
6) 
7) 
8) 
9) 
10) 
Question 2[4 marks]
Without rewriting the above code, explain how Oksana could improve this code further to calculate and output the total discounted cost of all the items being bought by a customer?
Save / Share Answers as a link
Share Button