Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise #3 Guess the Number (IN PYTHON PLEASE) Write a Guess the Number game that randomly assigns a secret number [1,20] for the user to

Exercise #3 Guess the Number (IN PYTHON PLEASE)

Write a Guess the Number game that randomly assigns a secret number [1,20] for the user to guess. I recommend hard coding your secret number at first to make testing your code easier. You can write this a number of ways, but try to stick to the instructions outlined here.

Write three methods to make your game work.

  • The first method should generate a random number and return the value to main to store in the secret number variable.
  • The second method should ask your user what his first guess is. Return this information to main.
  • The third method should take in the guess and the secret number via parameters, then evaluate whether or not the quess is correct. Return a string to let the user know if their guess was too high, too low, or correct.

You will need a nested loop in main. Youll want the outer loop to ask if the user wants to play again. Youll also need to think about how to include an inner loop that continues to call the third method until the user guesses correctly.

// I keep getting an error when I try to call my individual methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

Types of Interpersonal Relationships?

Answered: 1 week ago

Question

Self-Disclosure and Interpersonal Relationships?

Answered: 1 week ago