Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Challenge 4: INPUT: We want to ask the user for continual input, until the user writes the word QUIT in capital (uppercase) letter. (Hint! You'll
Challenge 4: INPUT: We want to ask the user for continual input, until the user writes the word "QUIT" in capital (uppercase) letter. (Hint! You'll need to use a loop here.) Using the input() function, ask the user to "What camp is your goal? Enter a Roman number between and V: " Store their input into a variable called base_goal. PROCESSING AND OUTPUT: First (before you do anything else!), convert the user input (base_goal) to uppercase letters using Python's built in function. (Which function? Look it up in the textbook or go through your lecture notes!) Next, if the user input was "1", print to the console the number "Base 1. Good.". If the user input was "II", print to the console the number "Base 2. Great!". If the user input was "III", print to the console the number "Base 3. A worthy goal!". If the user input was "IV", print to the console the number "Base 4. A noble goal!". If the user input was "V", print to the console the number "Base 5. You can do it!". If the user typed a word that is NOT "1", "II", "III", "IV" or "V", print to the console, "Invalid input". If the user typed the word "QUIT" or "quit", print "Onwards! Good luck!" (Hint! Because you already converted the input to uppercase letters in a previous step, in your loop, you only need to check for "QUIT" in uppercase letters). SAMPLE INPUT AND EXPECTED OUTPUT: Below, you'll see some examples of correct (valid) input, and then some examples of invalid input. helenathe@helenathe-ThinkPad E470:-/Desktop/Python1105/1105$ python3 p2 3.py What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: I Base 1. Good. What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: II Base 2. Great! What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: III Base 3. A worthy goal! What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: VI Base 5. You can do it! What camp is your goal? Enter a Roman number_between I and v, or enter 'QUIT' to quit: itt Base 3. A worthy goal! What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: ivi Base 4. A noble goal! What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: vi Base 5. You can do it! What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: i love mount everest! Invalid input. What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to qutt: 3 Invalid input. What camp is your goal? Enter a Roman number between I and V, or enter 'QUIT' to qutt: 5 Invalid input. What camp is your goal? Enter a Ronan number between I and V, or enter 'QUIT' to qutt: 10 Invalid input. What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to qutt: -!@#$ Invalid input. What camp is your goal? Enter a Roman number between I and v, or enter 'QUIT' to quit: qutt Onwards! Good luck
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started