Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For Python 3 You will write two functions. Write one function that takes a list of numbers as an argument and returns the maximum (largest)

For Python 3

You will write two functions.

Write one function that takes a list of numbers as an argument and returns the maximum (largest) number in the list.

Write another function that takes a list of numbers as an argument and returns the minimum of the list.

Do not use built-in functions max, min, or any function that sorts the list. Invoke/call both functions with the list [0, 3.14159, 5, 1, 9, 2.71828, -1]. Print the results. Your functions should work with lists of any size.

HINT: Set the max/min to the first element of the list and use a loop to iterate through the rest of the list checking if the value is larger/smaller than the max/min.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Find the median of the density f (x) 12 exp(jxj) , x 2 R.

Answered: 1 week ago

Question

Define the goals of persuasive speaking

Answered: 1 week ago