
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
Question
can you do it in python, thank you.

Transcribed Image Text:Problem Description:
In this assignment, you will need to write a program that will allow the user to play a game. The
program will start with showing the user a list of two games ('Guess the Number' and 'Math
Challenge') and ask the user which one she/he wants to play. However, to keep the assignment
manageable, you are being asked to implement only the first of these two games. If the user selects
the second game, a 'technical error' message is shown, and the list of games is again shown to
select
an
option from.
If the user selects the first game, "Guess the Number", the program will randomly generate a
number between 10 and 30 (inclusive) and allow the user at most 10 (ten) chances to guess it. If
the user can correctly guess the number within 10 chances, she/he is awarded one point, otherwise
zero point is awarded. After a round is over, the user is asked if she/he wants to play a game again
or not. If the user enters a Y', she/he is again shown the list of games to choose from. If the user
anything else, she/he is shown the total number of points obtained in this session of play (each
round contributes at most one point) and the program exits.
Implementation:
You need to implement the program using 5 (five) functions:
(i)
(ii)
(iii)
(iv)
(v)
get_validated_input
get_game_choice
play_math_challenge_game
play_guess_the_number_game
main
Each of these functions is dedicated to performing a single task. (i) gets a number from the user
within a specified range, (ii) gets a number from the user indicating which game she/he wants to
play, (iii) shows a message that this game is not currently playable, (iv) implements the game 'Guess
the Number', and (v) is the function that drives the program by presenting the user game options,
collecting the option and calling the appropriate game function, asking the choice to continue
playing, showing the total points at the end, bidding goodbye, etc.
Sample Outputs:
Sample output #1
Available games:
1. Guess the number
2. Math challenge
Please enter your choice (1/2): 1
===============
Guess the number
===============
I am thinking a number between 10 and 30
You have 10 chances left to guess the number
Please enter your guess (10-30): 2
Please enter your guess (10-30): 22
Sorry, you guessed wrong. Try again.
You have 9 chances left to guess the number
Please enter your guess (10-30): 24
Sorry, you guessed wrong. Try again.
You have 8 chances left to guess the number
Please enter your guess (10-30): 11
Sorry, you guessed wrong. Try again.
You have 7 chances left to guess the number
Please enter your guess (10-30): 12
Sorry, you guessed wrong. Try again.
You have 6 chances left to guess the number
Please enter your guess (10-30): 15
Sorry, you guessed wrong. Try again.
You have 5 chances left to guess the number
Please enter your guess (10-30): 18
Correct guess!
Enter 'Y' if you want to continue. n
You are leaving with 1 points
************* 318 ************
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 6 images

Knowledge Booster
Similar questions
- I'm interested in studying Python, therefore I'd appreciate it if you could point me in the right way.arrow_forwardI was hoping you could provide me with some in-depth advice on learning Python.arrow_forwardI was hoping you could provide me some comprehensive guidelines for studying Python.arrow_forward
- Is there a list of best practises for using Python somewhere?arrow_forwardWhy is it preferable to use a compiled language rather than an interpreted one, and what are those advantages? In what kinds of situations do you think it would be beneficial to make use of an interpreter?arrow_forwardWhat are the costs and benefits of aliasing in Python? How can it be avoided?arrow_forward
- Having trouble using coding a round robin on python, and an example of how it can be used. Any help would be appreciated.arrow_forwardWhat is Python? What are the benefits of using Python?arrow_forwardTell me why it's preferable to use a compiled language as opposed to an interpreted one. When would you find it most useful to have an interpreter present?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY