Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
In Python please
Transcribed Image Text:**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:** 9 1 6 8 2 2
**Player Numbers:** 6 8 3 9 2 1
**Total matches:** 1
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 the user to enter 6 numbers and store them** in another integer list named `player_list`.
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.
**To Solve this problem, we will create the following functions.**
| **Function Name** | **Description** |
|-----------------------|-----------------|
| **get_winning_number** | - This function generates random numbers between 1-9, stored in the random list and returns the list of 6 random numbers.<br>- This function does not have parameters and returns the random list. |
| **get_player_number** | - This function prompts the user to enter lottery guessing numbers and stores them into a list.<br>- This function does not have any parameters and returns the user guessing list.<br>- Make sure to validate the numbers, so they are in the range of 1-9 inclusive. |
| **get_matches** | - This function compares two lists position by position to see if there is a match.<br>- This function passes the random list and user guessing list.<br>- This function returns total count of matches. |
| **print_numbers** | - This function passes two lists and the matches count and displays them in the console. |
- **main:** The main function will call all the functions above.
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 5 steps with 2 images
Knowledge Booster
Background pattern image
Similar questions
- Code in C programming only ( not C++ or Java or Python) BeautifulPath You are supposed to write production ready code with Proper Unit Test Cases, Modularizaton etc. You need to write your test cases under user package in test folder. One sample test is created under same package for reference. Your code will be evaluated on the basis of code coverage, Code Quality, Best Practices and Bugs. NOTE: Here, we use CMocka for writing test cases and GCC Compiler. **PROBLEM:* Given a directed graph with N nodes and M edges. Each node is associated with lowercase english alphabet. Beauty of a path is defined as the number of most frequently occurring alphabet. Find the most beautiful path and return the maximum beauty value it has. *CONSTRAINTS:* 13->4->5) ie (aaca) lonut. Strictly Use the following Function :- int beauty(int v, int e, String s, int[] x, int[] y)arrow_forwardC Language Programming Questions Q ) This can be used to write a C program MS Visual C++ Dev C++ All answers are right Windows Notepadarrow_forwardhi sorry i forgot to mention that this is in python sorry!arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageComputer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONText book imageComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceText book imageNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Text book imageConcepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningText book imagePrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationText book imageSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY