Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

image text in transcribed

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

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago