Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Python 3.5 or newest release Imagine that the most of the functions that we h

ID: 3691489 • Letter: I

Question

In Python 3.5 or newest release

Imagine that the most of the functions that we have been using to process lists in Python do not exist. For the problems below you are not allowed to use any list methods (append, remove, insert, etc) or certain core Python functions specified in each problem. You may, however, use your own custom-written functions to solve these problems (i.e. if you find that your listlen() function would be useful in writing another function you are welcome to use it). Given these restrictions, write a series of functions that do the following:

4. Write a new function called "listappend" based on the following IPO

Make sure that you DO NOT use any list methods such as "append" in your program. Note that your original list should not change when you run this function. Here is a sample running of this program:

Explanation / Answer

def listlen(l):
ans=0
while True:
try:
a = l[ans]
ans+=1
except:
return ans
def listappend(l,n):
ln = listlen(l)
a = [0]*(ln+1)
for i in range(ln):
a[i]=l[i]
a[ln] = n
return a
b = [1,2,3,4,5,6,7,8]
a = listappend(b,10)
print(a)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote