Question: 17) Write the code with the right Python syntax. In this program, Luhn Algorithm is used to check if a credit card number is




17) Write the code with the right Python syntax. In this program, Luhn Algorithm is used to check if a credit card number is valid or not. The steps are shown in the following diagram: 7 9 9 2 7 F 3 9 8 7 1 3 x2 x2 x2 x2 x2 18 4 6 16 2 T 9 9 4 7 6 9 7 7 F- 2 3 7+9+ +4 +7+6+9+7+7+ 2 + 3 = 70 If the total ends in zero, then it's a valid card number. If not, it is an invalid card number. Communication (20 marks): 18. What are the advantages and disadvantages of technology: a) In terms of environment b) In terms of human health (10 marks) 19. How is Computer Science connected to other subjects like Biology, Physics, Chemistry, etc? Detail your answers with examples. 8 Application (15 marks): 20. Design a Python function named createSum()" that: -Reads in a string of numbers. - Converts the string to a list of integer numbers. -If the first number is odd, compute the sum of all the numbers. (7 marks) - Otherwise, if the first number is even, compute the product of all the numbers. -Returns the value that you computed above. Include docstring. Ex: if the string is '5 3 6' it would return 14. If the string is 4 25' it would return 40. 21) You have been asked to write an application for Bakery in Python. Your application should be able to hold the current quantity of muffins in the bakery's display window. The bakery makes 7 types of muffins every day. The day always starts off with 5 of each muffin type. Write a program which allows you to remove a muffin as it is purchased. Display the purchase sequence when the user wants to see it. Sample output: Quantity Left: Bran: 4 Chocolate: 3 Blueberry: 1 Carrot: 2 Lemon: 4 Banana: 1 Leftover-Supreme: 5 Purchase Sequence for Today: Banana, Lemon, Bran, Banana, Banana, Chocolate, Banana, Blueberry, Carrot, Blueberry, Chocolate, Carrot, Blueberry, Blueberry, Carrot
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
