Guess 1-9 for player number 1: 80 Invalid number, enter 1-9: -10 Invalid number, enter 1-9: 6 Guess 1-9 for player number 2: 8 Guess 1-9 for player number 3:3 Guess 1-9 for player number 4:9 Guess 1-9 for player number 5:2 Guess 1-9 for player number 6: 1 Winning Numbers: 916822 Player Numbers: 683921 Total matches: 1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
In Python please
Program output is as follows:
Program output:
Guess 1-9 for player number 1: 80
Invalid number, enter 1-9: -10
Invalid number, enter 1-9: 6
Guess 1-9 for player number 2: 8
Guess 1-9 for player number 3:3
Guess 1-9 for player number 4:9
Guess 1-9 for player number 5: 2
Guess 1-9 for player number 6: 1
Winning Numbers: 916822
Player Numbers: 683921
Total matches: 1
Transcribed Image Text:Program output is as follows: Program output: Guess 1-9 for player number 1: 80 Invalid number, enter 1-9: -10 Invalid number, enter 1-9: 6 Guess 1-9 for player number 2: 8 Guess 1-9 for player number 3:3 Guess 1-9 for player number 4:9 Guess 1-9 for player number 5: 2 Guess 1-9 for player number 6: 1 Winning Numbers: 916822 Player Numbers: 683921 Total matches: 1
Purpose:
Python parallel list implementations
Program Specifications:
1. Write a program that simulates a lottery. The program should have a list of 6 integers
named winning_list, with a randomly generated number in the range of 1 through 9
inclusive for each element in the list.
2. The program should ask user to enter 6 numbers and store them in another integer list
named player_list.
To Solve this problem, we will create the following functions.
get_winning_number.
get_player_number
3. The program then compares the numbers in 2 lists to find out how many numbers match.
If two numbers are at the same position in both lists, it is a match. (This is using parallel
list concept to compare two lists.)
4. The program output should display the winning numbers, player's numbers, and how
many numbers matched. For instance, if your winning numbers are 3,5,9,1,4,7 and your
player's numbers are 2,5, 7,1, 9,8, then you have two matches (5 and 1). 5 is on the
second position and 1 is on the fourth position in both lists.
5. Input Validation: The guessing number entered by user must be between 1-9 inclusive.
get_matches
print_numbers
main
●
●
Page
●
1
●
●
>
This function compares two list position by position to see if
there is a match.
This function passes the random list and user guessing list.
● This function returns total count of matches.
This function generates random number between 1-9, stored in
the random list and return the list of 6 random numbers.
This function does not have parameters and returns the
random list.
This function prompts the user to enter lottery guessing
number and stored them into a list.
This function does not have any parameters and returns the
user guessing list.
Make sure to validate the number, so it is in the range of 1-9
inclusive.
This function passes two list and the matches count and displa
them in the console. (See Program output)
main function will call all the functions above.
Transcribed Image Text:Purpose: Python parallel list implementations Program Specifications: 1. Write a program that simulates a lottery. The program should have a list of 6 integers named winning_list, with a randomly generated number in the range of 1 through 9 inclusive for each element in the list. 2. The program should ask user to enter 6 numbers and store them in another integer list named player_list. To Solve this problem, we will create the following functions. get_winning_number. get_player_number 3. The program then compares the numbers in 2 lists to find out how many numbers match. If two numbers are at the same position in both lists, it is a match. (This is using parallel list concept to compare two lists.) 4. The program output should display the winning numbers, player's numbers, and how many numbers matched. For instance, if your winning numbers are 3,5,9,1,4,7 and your player's numbers are 2,5, 7,1, 9,8, then you have two matches (5 and 1). 5 is on the second position and 1 is on the fourth position in both lists. 5. Input Validation: The guessing number entered by user must be between 1-9 inclusive. get_matches print_numbers main ● ● Page ● 1 ● ● > This function compares two list position by position to see if there is a match. This function passes the random list and user guessing list. ● This function returns total count of matches. This function generates random number between 1-9, stored in the random list and return the list of 6 random numbers. This function does not have parameters and returns the random list. This function prompts the user to enter lottery guessing number and stored them into a list. This function does not have any parameters and returns the user guessing list. Make sure to validate the number, so it is in the range of 1-9 inclusive. This function passes two list and the matches count and displa them in the console. (See Program output) main function will call all the functions above.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
InputStream
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education