Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question # 2 : Write a program that finds the range ( difference between the smallest and largest ) of 8 positive integer numbers the
Question #:
Write a program that finds the range difference between the smallest and largest of positive integer numbers the user inputs inside a "for loop" with a range
The "for" loop range function should start at and go
The user should enter the numbers as integers there should only be one input statement inside the for loop, not input statements for the integers
Before the loop starts create variables for the largest and smallest numbers and set them equal to zero. Then inside of the loop determine the largest and smallest number. You do that with an if test.
When the loop ends and you are outside the loopdetermine the range difference between the smallest and largest number
Print the range.
Then ask the user if they want to do this again use a while loop for this
Don't forget comments at the top of the code.
And don't forget to test the input integer to make sure the code does not error out when a user enters a float or a letter. Use try and except inside the loop where you convert the input from string to intIn python please
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