Question: Write a Python program that allows a user to play a guessing game against the computer. The program should use a (CLI). The user should
Write a Python program that allows a user to play a guessing game against the computer. The program should use a (CLI). The user should be prompted with an invitation to guess a number between 1 and 20 and after each guess should be told if they are too high or too low. When the number is finally guessed the user should be asked if they want to play again.
import random import math
def GetInput(s): # ... return num
#--------------------------------------------------------------- # PlayGussingGame #--------------------------------------------------------------- def PlayGussingGame(): target = guess = GetInput()
while guess != target:
#================================================================
k = input("Welcome! Press q to quit or any key to continue:")
while k != 'q': PlayGussingGame() k = input("Press q to quit or any key to continue:")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
