Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python If a set of functions is well-documented, then it is called an Application Programmer Interface, since the programmers who want to call these functions

Python

image text in transcribed

If a set of functions is well-documented, then it is called an Application Programmer Interface, since the programmers who want to call these functions need to know a number of things in order to call the functions correctly. Each function definition in the set must include the following information in a comment in order for the set of functions to be considered an API: the name of the function, what parameter the function will accept (if any) what the function does with its parameter, .what value the function returns (if any). whether the function does any input/output. The API you will write for this assignment is called "A List API" because each function in the API operates on a Python list of integers. You must write the full function definition for each of the following: 1. swapFirstAndLast0: Takes a Python list as parameter and modifhes the list parameter by swapping its first and last elements. Does not return anything 2. shiftRight0: Takes a Python list as parameter and modifies the list parameter by shifting all elements in the list to the right and putting the last (rightmost) element in the zeroth position of the list. Does not 3. double0: Takes a Python list as parameter and modifies the list parameter by doubling the value of each element in the list. Does not return anything 4. is Sorted0: Takes a Python list as parameter and returns True if the list parameter is sorted inascending order, returns False otherwise. You can assume that the list parameter has only numbers in it. 5. replaceEvens0: Takes a Python list as parameter and replaces any even elements of the list parameter with a zero. This looks at the value of the element to see if it is even, the index of the element does NOT determine if the element is replaced with a 0 in the list. Does not return anything

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

What principal roles do line managers undertake in HRD?

Answered: 1 week ago

Question

What is topology? Explain with examples

Answered: 1 week ago

Question

What is linear transformation? Define with example

Answered: 1 week ago