Question: HELP! 1. Write a function that takes an integer val as an argument and asks user to enter a guess number. -If the number is

HELP!

1. Write a function that takes an integer val as an argument and asks user to enter a guess number.

-If the number is greater than val, the function displays Too high and prompt again for a number

-If the number is less than val, the function displays Too low and prompt again for a number

-If the number equals val, the function displays Got it! and ends.

-Call the function repeatedly until the user enters the right number.

My code: It runs into and endless loop of either "Too high" or "Too low". What is wrong with my code?

HELP! 1. Write a function that takes an integer val as an

GNU nano 2.5.3 # ! /usr/bin/pythons import randonm def guessValue (val) nint (input ("Enter the number ")) while n-=val: if n val: print ("Too high") else: print "Too low") print ("Got it! val -random.randint l,100) guessValue (val)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!