Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

RESTRICTION: You may not use the Python built-in function you are implementing within its own implementation. In the absence of additional restrictions, you may use

RESTRICTION: You may not use the Python built-in function you are implementing within its own implementation. In the absence of additional restrictions, you may use other Python built-in functions and methods. If given a list or sequence as input, you must not change the original list or sequence.

image text in transcribed
min() Write a function min(lst) that models a limited version of the behaviour of the builtin function. In Python, the min() function is capable of signicantly more - read about it here. Input: a non-empty sequence (list) of comparable objects 1st. Output: the smallest item in 1st. reversed() Write a function reversed(seq) that models a limited version of the behaviour of the built-in function. You may not use list slicing (i.e. seq[::-1]) in this function, although it is a cool trick to know! Input: a sequence seq. Output: a new list containing all items in 1st in reverse order. Note: Remember that a sequence can be a list, a string, a tuple, or a range, so this function must work for all these types. sum() Write a function sum(lst) that models a limited version of the behaviour of the builtin function. Input: a sequence (list) of numbers 1st. Output: the sum of all numbers in 1st

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

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

how do we organize resources to get there?

Answered: 1 week ago