Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION #1 Give an example of a function you've used and the value (or type of value) it returns. For example: The function max() returns

QUESTION #1

Give an example of a function you've used and the value (or type of value) it returns.

For example:

The function max() returns the largest value in a list of numbers or the first word alphabetically in a list of Strings.

QUESTION #2

Using one complete sentence, describe a problem in your life that could be solved or is solved by chaining together multiple tasks or functions.

For example:

When I do laundry, dirty clothes are input into the washing machine and clean (but wet) clothes are output. I then take those wet clothes, and they are input into the dryer. The dryer outputs dry clothes that are then input into the folding machine (AKA, me). Once folding is finished, the laundry is done. The final result is clean, folded clothes.

The code might look something like this:

l = dirty laundry

def dirtyLaundry(l):

w = wash(l)

d = dry(w)

f = fold(d)

return f

QUESTION #3

Trace the following code to determine the output:

def mysteryFunction(list): for i in range(len(list)-1,0,-1): for idx in range(i): if list[idx]>list[idx+1]: temp = list[idx] list[idx] = list[idx+1] list[idx+1] = temp list = [19,2,31,45,6,11,121,27] mysteryFunction(list) print(list)

QUESTION #4

Write a program that asks the user for a number. If it is between 1 and 255, output the corresponding ASCII character.

Sample Run

Enter a number between 1 and 255: 97 a

THIS IS A SIMPLE, HIGH SCHOOL COMPUTER SCIENCE COURSE IN PYTHON. PLEASE DON'T MAKE TOO COMPLICATED, THANK YOU!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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 is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago