Question: BEFORE YOU ANSWER: Please read the question thoroughly and only use PYTHON. PLEASE USE FORMAT GIVEN SO I CAN LEARN! -thanks! Problem 1. (Min Max
BEFORE YOU ANSWER: Please read the question thoroughly and only use PYTHON. PLEASE USE FORMAT GIVEN SO I CAN LEARN! -thanks!
Problem 1. (Min Max ) Write a program min_max.py that reads in floats (as many as the user enters) from standard input and writes out the minimum and maximum values along with their ranks, ie, their positions (starting at 1) in the input.
THIS IS THE ANSWER SHOULD BE GETTING:
$ python min_max . py
3.0 1.0 5.0 4.0 2.0
min val = 1.000000 , min rank = 2
max val = 5.000000 , max rank = 3

File Edit Format Run Options window Help min max.py: reads in floats (as many as the user enters) from standard input and writes out the minimum and maximum values along with their ranks, ie, their positions (starting at 1) in the input import stdio Smallest and largest floats. NEG INFINITY float -inf') POS INFINITY float ('inf') Read floats from standard input into a list a Define variables to keep track of the mininum value and its rank and the maximum value and its rank. min val min rank max val max rank Iterate the list a to identify the minimum value and its rank and the maximum value and its rank. for i, v in enumerate (a) Write the results (min val, min rank, max val, max rank)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
