Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding in python: Here is the error code I receive from my test: File ', line 38, in test_guessing_game self.assertEqual(0.0, guessing_game(2)) File , line 148,

Coding in python:

Here is the error code I receive from my test:

File "', line 38, in test_guessing_game

self.assertEqual(0.0, guessing_game(2))

File "", line 148, in guessing_game

guess = int(input('Take a guess: '))

ValueError: invalid literal for int() with base 10: 'n'

image text in transcribed

def guessing_game (money): Note: when you are asking the user if they would like to play again, make sure their answer is in the format 'y for yes and 'n' for no. Allows the user to play a guessing game for two dollars. Ask the user to play until they say no or until they can't pay. Parameters: money - an int representing how much money the user has Returns The user's money -2 if they failed to guess the correct number in 4 tries or the user's money+20 if they correctly guess the number. if not can_pay (money, 2): print( 'Sorry not enough money.') return money number random. randint (0,100) guess = int(input ('Take a guess: tries1 while True: ')) if guess number: print( VICTORY!' return money+20 else: if guess number: print('Lower') guess = int( input (Take a guess: tries += 1 if tries = 4: ) print( 'You Lose') return money - 20

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

Students also viewed these Databases questions