Question: Show me the steps to solve: The program will take a sequence of non - negative integers as well as a threshold value as input,
Show me the steps to solve:
The program will take a sequence of nonnegative integers as well as a threshold value as input, then display whether each of the original inputs is greater than, less than, or equal to the threshold. In other words, your program should:
a Create a sequence object list to accept user input
b Using a while loop prompt the user to enter a sequence of nonnegative integers, stored in the sequence object from the previous step.
o To indicate that they have entered the entire sequence, a user should input a
negative integer at which point the program will exit the while loop and commence
to the main algorithm.
c Prompt the user to enter a threshold value
d Using a for loop, display each number from the sequence and whether that
number is greater than, less than, or equal to the threshold value
Since there are multiple types of input, you MUST include prompts for your inputs.
Hint: You may also wish to use the input function, type casting, IfElifElse or continue statements, and comparison operators
Example:
Enter the next integer. Entering a negative integer will end the sequence:
Enter the next integer. Entering a negative integer will end the sequence:
Enter the next integer. Entering a negative integer will end the sequence:
Enter the next integer. Entering a negative integer will end the sequence:
Enter the next integer. Entering a negative integer will end the sequence:
Enter the threshold value:
is less than
is greater than
is equal to
is less than
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
