This code is supposed to do a simple lottery matching: 1. User inputs a 4-digit lottery...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This code is supposed to do a simple lottery matching: 1. User inputs a 4-digit lottery ticket. 2. If the ticket matches the 4 digits of the winning number, print out a message that reads 1st Prize! \n. 3. If the ticket matches only 3 digits of the winning number, print out a message that reads 2nd Prize!\n. 4. If the ticket matches only 2 digits of the winning number, print out a message that reads 3rd Prize!\n. 5. In all other cases, print out a message that reads: No Prize! Better luck next time!\n The digits have to match in both number and position. For example, if the winning number i 1234 , the lottery ticket 1534 would be a 2nd Prize winner, but the ticket 5134 would be a 3rd Prize winner. Ticket 3415 has all the digits but in a different position from the original, so it would be a losing ticket. Your objective is to write code that checks the numbers and prints out the correct message. The existing code must not be changed and includes the winning ticket number, and code that takes the user's input. Your code must be written after the line that reads //TODO: Your code goes here . Make sure to comment your code to make clear what you intend to do with it! This code is supposed to do a simple lottery matching: 1. User inputs a 4-digit lottery ticket. 2. If the ticket matches the 4 digits of the winning number, print out a message that reads 1st Prize! \n. 3. If the ticket matches only 3 digits of the winning number, print out a message that reads 2nd Prize!\n. 4. If the ticket matches only 2 digits of the winning number, print out a message that reads 3rd Prize!\n. 5. In all other cases, print out a message that reads: No Prize! Better luck next time!\n The digits have to match in both number and position. For example, if the winning number i 1234 , the lottery ticket 1534 would be a 2nd Prize winner, but the ticket 5134 would be a 3rd Prize winner. Ticket 3415 has all the digits but in a different position from the original, so it would be a losing ticket. Your objective is to write code that checks the numbers and prints out the correct message. The existing code must not be changed and includes the winning ticket number, and code that takes the user's input. Your code must be written after the line that reads //TODO: Your code goes here . Make sure to comment your code to make clear what you intend to do with it!
Expert Answer:
Answer rating: 100% (QA)
Here I use rand for generate lottery ticket and validate user inp... View the full answer
Related Book For
Managerial Accounting An Integrative Approach
ISBN: 9780999500491
2nd Edition
Authors: C J Mcnair-Connoly, Kenneth Merchant
Posted Date:
Students also viewed these accounting questions
-
In my spanish class we are supposed to do a research paper on a spanish speaking country and talk about a topic of interest. the country that i am writing about is ecuador. and my topic of interest...
-
In all other cases A unifom surface charge density 8a exists over the entire xy-plane except for a circular hole of radius 'a' centered at the origin. The electric field at a point P(0,0, 3a). On the...
-
You are now going to do a simple breakeven point for number of passengers on a flight for the years 20x4 to 20x6. Go to the worksheet that says Template for DB 3.2. Complete the breakeven analysis...
-
Q-1 A motor car shaft consists of a steel tube 30 mm internal diameter and 4 mm thick. The engine develops 10 kW at 2000 r.p.m. Find the maximum shear stress in the tube when the power is transmitted...
-
A bicycle shop plans to offer 2 specially priced childrens models at a sidewalk sale. The basic model will return a profit of $120 and the deluxe model $150. Past experience indicates that sales of...
-
Blue Mountain Products manufactures and sells a variety of camping products. Recently, the company opened a new plant to manufacture a lightweight, self-standing tent. Cost and sales data for the...
-
You are the sales manager for a company selling components to companies in the auto industry and are considering upgrading computer equipment for the sales force. Draft a document detailing the...
-
Because of rapidly advancing technology, Southern Publications Corporation is considering replacing its existing typesetting machine with leased equipment. The old machine, purchased two years ago,...
-
Sandhill Audio, Inc. manufactures speakers. During March, selected information is provided below for transactions and accounts: Raw materials acquired for cash $84600 Cost of direct materials used in...
-
Carla Company uses the perpetual inventory system. The following information is available for January of the current year, when Carla Company sold 1,600 units of inventory on January 14. Using the...
-
learning of marginal analysis is fundamental to decision making. To accurately apply this analysis, we need to understand the full range of costs and benefits tangible and intangible. To make this...
-
what laws govern business and consumer banking transactions?
-
The truck has an salvage value ofsz,400, andis epected to be diven 110.000 maesover as estimated useful Be of s years. Actual miles driven were 15,500 in 2017 and 13,800 in 2018 v (al Your answer is...
-
Discuss the role that wholesale banking plays in economic development?
-
discuss the interplay between internal and external conflicts in shaping the complexities of character motivations and actions within literary works ?
-
How the lending system is applied in the merchant of Venice?
-
Different compounding periods, are used for different types of investments. In order to properly compare investments or loans with different compounding periods, we need to put them on a common...
-
Use the T account for Cash below to record the portion of each of the following transactions, if any that affect cash. How do these transactions affect the companys liquidity? Jan. 2 Provided...
-
Blue Moon Limousine Service runs an hourly shuttle from the local airport to the waterfront district in downtown. Its drivers are expected to learn their route and then be able to meet the companys...
-
What are the primary steps in doing an incremental analysis?
-
Chewy Treats, Inc., makes several lines of caramel-based candies and treats. Each product runs on its own set of machines. The lines Chewy makes are Wrapped Caramels, Chocolate-Covered Caramels,...
-
Presented below is selected information related to Tsui Repairs at December 31, 2025. Tsui reports financial information monthly (amounts in thousands). a. Determine the total assets of Tsui Repairs...
-
Explain the career opportunities in accounting.
-
Collins Computer Timeshare entered into the following transactions during May 2025. 1. Purchased computers for R\($20,000\) from Digital Equipment on account. 2. Paid R\($4,000\) cash for May rent on...
Study smarter with the SolutionInn App