Question: I have to create your own example of a function that modifies a list passed in as an argument. Describe what your function does in

I have to "create your own example of a function that modifies a list passed in as an argument. Describe what your function does in terms of arguments, parameters, objects, and references." (in PYTHON 3)

So, I want to make a list of "declarations" and then take another list of "exclamations" and cycle thru both lists to attach each element of the "exclamations" list onto each element of the "declarations" list, in order.

I can't figure out how to make it work.

This is what I have:

#create a list of 3 string values and assign it to an object called declarations declarations = ["Cats are cool", "Dogs are awesome", "Birds are radical"] #create a second list exclamations = ["heck yeah!", "ain't that the truth!", "NOT!" ] #modify the declarations list by traversing it sequentially and adding the exclamations list, in order, to the elements in the #declarations list def modify_list(declarations): for i in declarations: while len(exclamations)

modify_list(declarations)

it won't allow me to show my indentations, so here's a pic:

I have to "create your own example of a function that modifies

That doesn't work, obviously. How can I make it work?

#create a list of 3 string values and assign it to an object called declarations declarations ["Cats are cool", "Dogs are awesome " , "Birds are radical"] #create a second list exclamations["heck yeah!", "ain't that the truth!", "NOT!" #modify the declarations list by traversing it sequentially and adding the exclamations list, in order, to the elements in the declarations list def modify list (declarations) for i in declarations: while len (exclamations) -len (declarations) : for i in exclamations: suffix 0 suffix = suffix + i return sufrix whole-phrase declarations.append(exclamations) print (whole phrase) modify list (declarations)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!