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?

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
Get step-by-step solutions from verified subject matter experts
