17) Write the code with the right Python syntax. In this program, Luhn Algorithm is used...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Let f(x) = X Wx Draw the graph. To draw the line, click the endpoint, then a second point on the line To draw the square root, click the vertex then a second point on the graph Add the open dot and...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Discussion Post: Suppose you were considering investing in a Series I Bond. The bond will pay 5% interest. However, bond A compounds annually, and bond B compounds semiannually. Provide a detailed...
-
Bath n Bedroom sets its prices to allow for overhead expenses that average 50% of unit cost and a normal profit of 30% of cost. For towel sets priced at $39.89, determine: a. The wholesale cost. b....
-
How do stock dividends differ from cash dividends? How do stock dividends differ from stock splits?
-
Explain how systems modeled on the human immune system might provide a solution to the problem of computer viruses or of unsolicited bulk e-mails (spam).
-
Khonner Stores, Inc., sells electronics and appliances. The excerpts that follow are adapted from Khonner Stores financial statements for 2014 and 2013. Requirements 1. How much was Khonner Stores...
-
The Gemini Corporation was operating its business as per the following working capital cycle days: Scenario A Average age of inventory - 40 days Average collection period - 60 days Average payment...
-
For this assignment, read the scenarios below and critique the etiquette in each. Using bullet points for your responses is preferable. Scenario 1: Read the email below and explain what Jane Doe did...
-
(d) Define Floating-point representation, Truncation error, and Global error with examples.
-
One key limitation of Sage 50 Accounting software, while there is a Sage 50 cloud version that offers some cloud-based features, the mobile access and functionality may not be as extensive as with...
-
Other than the wind speed, what factor has the most impact on the amount of power generated by a wind turbine? Swept area of rotor Turbine style Terrain Blade material.
-
15. If y = 3x-4x+2 then slope at x = 1 is: (1) 1 (2) 2 (3) 4 (4) -2 16. sin240 = ? (1) - 2 (3) 3 1/2 17. Value of sin 2 is (4) (2) 12 (1) 23 (2) (3) 90 180 (4) 0 18. The rate of mass of the gas...
-
Your 3 year old nephew got into the workbench and mixed iron filings into a container with sugar and marbles. Explain the steps you would take to separate and recover each substance (use point form...
-
What is the role of interscholastic athletics in our society?
-
What mass of H2 will be produced when 122 g of Zn are reacted? Zn(s) + 2HCl(aq) ( ZnCl2(aq) + H2(g)
-
Determine the probability mass function of \(X\) from the following cumulative distribution function: \[ F(x)=\left\{\begin{array}{lr} 0 & x. \] Figure 3.3 displays a plot of \(F(x)\). From the plot,...
-
The probability that a wafer contains a large particle of contamination is 0.01. If it is assumed that the wafers are independent, what is the probability that exactly 125 wafers need to be analyzed...
-
Two new product designs are to be compared on the basis of revenue potential. Marketing believes that the revenue from design A can be predicted quite accurately to be \(\$ 3\) million. The revenue...
Study smarter with the SolutionInn App