Question
Design a program that asks the user to enter a series of numbers. The user should enter -99 to signal the end of the series.
Design a program that asks the user to enter a series of numbers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered. Do not put the numbers in a list or use the Python supplied functions to find the minimum and maximum values in a list.
Before writing any code, analyze the problem. As described in the examples for Python Programming Tutorials, Lesson 4, identify the inputs to the program and outputs coming from the program. Describe the processing as a logical sequence of steps (i.e., an algorithm). Summarize the analysis in the form of an IPO chart and include the IPO chart as comments at the top of your source code (.py) file. IPO chart comments are illustrated in the examples for Lesson 4.
Here is an algorithm you can use:
Write "Enter a number (enter -999 to end)"
Get number
highest = number
lowest = number
While (number != -999)
if (number > highest)
highest = number
if (number < lowest)
lowest = number
Write "Enter a number (enter -999 to end)"
Get number
Write "The highest number is ", highest
Write "The lowest number is ", lowest
Convert this algorithm into a Python script inside of a def main(): module as shown in Lesson 4. Run the program in Pep 8 to make sure it produces the results you expected.
Turn in:
Source code (.py script) with IPO comments
Screen shot of testing
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