4. (25p) Consider a lottery game where any participant must choose 4 different numerals from 0...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. (25p) Consider a lottery game where any participant must choose 4 different numerals from 0 to 9, both inclusive. We would like to develop a Python program that directs participants to submit their choices as end-users. We assume that participants are clever enough to submit integers but not clever enough to submit numerals. In other words, by mistake, they can submit negative integers or integers greater than 9. In further detail, the program needs to repeatedly ask for a user-input until four different numerals are submitted by the end-user. A submission should be appended to a list, one-by-one, if it is a numeral and it is not submitted already. For incorrect submissions, the program will print an appropriate warning message to the console. Write a Python program that executes the above tasks. Depending on correct and incorrect submissions, your program should interact with the end-user by printing an output to the console similar to the following. However, your program should be generic and work for all user inputs in integer form. Enter choice 1: 8 Enter choice 2: -2 Please choose a numeral from 0 to 9. Enter choice 2: 7 Enter choice 3: 10 Please choose a numeral from 0 to 9. Enter choice 3: 0 Enter choice 4: 7 Please choose a different numeral at each time. Enter choice 4: 5 Your choices are [8, 7, 0, 5]. 4. (25p) Consider a lottery game where any participant must choose 4 different numerals from 0 to 9, both inclusive. We would like to develop a Python program that directs participants to submit their choices as end-users. We assume that participants are clever enough to submit integers but not clever enough to submit numerals. In other words, by mistake, they can submit negative integers or integers greater than 9. In further detail, the program needs to repeatedly ask for a user-input until four different numerals are submitted by the end-user. A submission should be appended to a list, one-by-one, if it is a numeral and it is not submitted already. For incorrect submissions, the program will print an appropriate warning message to the console. Write a Python program that executes the above tasks. Depending on correct and incorrect submissions, your program should interact with the end-user by printing an output to the console similar to the following. However, your program should be generic and work for all user inputs in integer form. Enter choice 1: 8 Enter choice 2: -2 Please choose a numeral from 0 to 9. Enter choice 2: 7 Enter choice 3: 10 Please choose a numeral from 0 to 9. Enter choice 3: 0 Enter choice 4: 7 Please choose a different numeral at each time. Enter choice 4: 5 Your choices are [8, 7, 0, 5].
Expert Answer:
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
Why the a worker's right "a safe and healthy workplace" under U.S. law mean a lot to you? Write about 2 paragraphs.
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
What are the lessons of the 1997 Asian financial crisis? Were the IMF supported adjustment programs successful in their objective? Were there flaws in their design?
-
Gravenstein Chemicals wishes to raise $5 million by an issue of stock. It expects direct expenses to absorb 1% of the money raised and the underwriters to charge a spread of 4%. If the announcement...
-
On September 10, Melinda Johnson was auditing the financial statements of a new audit client, Mother Earth Foods, a health-food chain that has a June 30 year-end. The company is privately held and...
-
Jeanne Li was injured in a car accident caused by a negligent driver. A court settlement provides Jeanne with \($10,000.00\) annual payments for life to pay for her chronic medical expenses. An...
-
The following direct quote exchange rates are found on the spot market today. a. Euro: $.9347 b. Israeli shekel: $.2586 c. British (U.K.) pound: $1.6544 d. Japanese yen: $.009423 Calculate the price...
-
Describe how to report risks and hazards identified by the following: risk assessment personal assessment methods of work safe systems of work manufacturers' technical information data sheets...
-
The state of Kentucky filed a tax lien against Panbowl Energy, claiming unpaid taxes. Six months later, Panbowl bought a powerful drill from Whayne Supply, making a down payment of $11,500 and...
-
Purchasing Power Parity a. Explain what is meant by PPP b. If a cup of coffee costs $2 in Canada, and 100 shillings in Kenya, what would PPP predict the Kenyan chilling to be worth in Canadian...
-
To whom is the internal audit report distributed? How should it be distributed?
-
What were some of the reasons for the growth in demand for auditing in the 19th century?
-
Franks wants a system of forecasting that will provide as accurate a picture as possible of first year sales in order to satisfy demands from head office who are sponsoring the launch of Pizza...
-
Describe the reviewing and editing process for the audit report.
-
How did the audit function evolve in the UK?
-
A better understanding of social entrepreneurship requires a good understanding of commercial and social entrepreneurs. Although social entrepreneurs share some of the qualities of regular...
-
What is your opinion of advertising awards, such as the Cannes Lions, that are based solely on creativity? If you were a marketer looking for an agency, would you take these creative awards into...
-
Grant leased an apartment to Epstein for the term May 1, 2010, to April 30, 2011, at $750 a month payable in advance on the first day of each and every month of said term. At the time the lease was...
-
Two-year-old David Allen was bitten by Joseph Whiteheads dog while he was playing on the porch at the Allen residence. Allen suffered facial cuts, a severed muscle in his left eye, a hole in his left...
-
Almega Corporation, organized under the laws of State S, has outstanding twenty thousand shares of $100 par value nonvoting preferred stock calling for noncumulative dividends of $5 per year; ten...
-
The following data are from the current accounting records of Crest Company: The president of the company is concerned that the company may be in violation of a debt covenant that requires the...
-
On December 31, 2018, Edmand, Inc., issued \(\$ 750,000\) of 11 percent, five-year bonds for \(\$ 722,400\), yielding an effective interest rate of 12 percent. Semiannual interest is payable on June...
-
On January 1, 2018, Ranier, Inc., issued \(\$ 300,000\) of ten percent, 15 -year bonds for \(\$ 351,876\), yielding an effective interest rate of eight percent. Semiannual interest is payable on June...
Study smarter with the SolutionInn App