def ask_user(): Returns clean input of type string in all caps to the user :return: input string in all CAPS return "LOW"

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

provided code:

 
def ask_user():
IT || ||
Returns clean input of type string in all caps to the user
:return: input string in all CAPS
|| || ||
return "LOW"
Transcribed Image Text:def ask_user(): IT || || Returns clean input of type string in all caps to the user :return: input string in all CAPS || || || return "LOW"
TODO 8: Convert ask for input then return an all upper case string → ask user() function
Within the ask_user function:
✓ Print the constant_SEARCH_QUESTION
✓ Create an input statement with no parameters. Please use the identifier "raw"
✓ Convert the input into all capital letters for easer processing and minimize opportunities
for errors. Please use the identifier "upper_raw"
✓ Return the upper raw
Each check is a line of code.
Be sure to indent this code within the function ask user
In order to capitalize all the text within a string, use .upper() string method: (This is not the
code you type, it's just an example as a reminder)
raw = "aBcD"
upper raw = raw.upper()
print (upper_raw) # this would output "ABCD"
Please make sure you have the following results before going to the next step:
<ENTER>
high
correct
Press <enter> when you are ready.
Is the guess too high, too low or correct?
high
Is the guess too high, too low or correct?
correct
<ENTER>
Mind Reader.. The computer will guess a number Mind Reader.. The computer will guess a number
between 1 1000 in less than 11 guesses.
between 1 1000 in less than 11 guesses.
Think of a number between 1 and 1000
Think of a number between 1 and 1000
Got it with 9 guesses left
Game over...
bad
correct
+++++
Press <enter> when you are ready.
Is the guess too high, too low or correct?
bad
BROKE
Is the guess too high, too low or correct?
correct
Got it with 9 guesses left
Game over...
The high -vs- High -vs- HIGH should have no impact on this code running as shown above.
Transcribed Image Text:TODO 8: Convert ask for input then return an all upper case string → ask user() function Within the ask_user function: ✓ Print the constant_SEARCH_QUESTION ✓ Create an input statement with no parameters. Please use the identifier "raw" ✓ Convert the input into all capital letters for easer processing and minimize opportunities for errors. Please use the identifier "upper_raw" ✓ Return the upper raw Each check is a line of code. Be sure to indent this code within the function ask user In order to capitalize all the text within a string, use .upper() string method: (This is not the code you type, it's just an example as a reminder) raw = "aBcD" upper raw = raw.upper() print (upper_raw) # this would output "ABCD" Please make sure you have the following results before going to the next step: <ENTER> high correct Press <enter> when you are ready. Is the guess too high, too low or correct? high Is the guess too high, too low or correct? correct <ENTER> Mind Reader.. The computer will guess a number Mind Reader.. The computer will guess a number between 1 1000 in less than 11 guesses. between 1 1000 in less than 11 guesses. Think of a number between 1 and 1000 Think of a number between 1 and 1000 Got it with 9 guesses left Game over... bad correct +++++ Press <enter> when you are ready. Is the guess too high, too low or correct? bad BROKE Is the guess too high, too low or correct? correct Got it with 9 guesses left Game over... The high -vs- High -vs- HIGH should have no impact on this code running as shown above.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT