Question: I'm having trouble implementing the function put_in based on the specidifcations when I try to run my code I get the error code AttributeError: 'NoneType'

I'm having trouble implementing the function put_in based on the specidifcations when I try to run my code I get the error code

AttributeError: 'NoneType' object has no attribute 'sort'

NOTE: Note that the function put_in should not return anything

Below is my code:

def put_in(alist,value): """ Adds a value to a sorted list, resorting as necessary. Examples: If a = [0,2,3,4], put_in(a,1) makes a = [0,1,2,3,4] If a = [0,2,3,4], put_in(a,2) makes a = [0,2,2,3,4] If a = [], put_in(a,3) makes a = [3] Parameter a: The list to append to Precondition: a is a sorted list of a single type of element Parameter value: The value to append Precondition: value has the same type as the elements of a """ appends_value = alist.append(value) print(appends_value) sorts = appends_value.sort() print(sorts)

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!