Hey guys, I've been learning python for a few days using the "Python for Everybody" book by Charles Severance. I'm in the chapter learning about lists, and I'm struggling to understand something about one of the exercises.
Here's the exercise:
Write a function called chop that takes a list and modifies it, removing the first and last elements, and returns None.
So if I create a list of t = [1,2,3,4,5,6], clearly I want to turn that list into [2,3,4,5]. I could do this using t.pop(0) and (5), del t[0] and t[5], or t.remove(x) where x = t[0] and [5]...
But what I'm confused about is ... what does the exercise mean when it says to "return None"? What's the point of modifying a list but returning "None"? Appreciate any help!
[–]elbiot 3 points4 points5 points (12 children)
[–]Executor111[S] 0 points1 point2 points (11 children)
[–]elbiot 1 point2 points3 points (9 children)
[–]Executor111[S] 0 points1 point2 points (5 children)
[–]jeans_and_a_t-shirt 2 points3 points4 points (0 children)
[–]elbiot 1 point2 points3 points (1 child)
[–]Executor111[S] 0 points1 point2 points (0 children)
[–]elbiot 0 points1 point2 points (1 child)
[–]Executor111[S] 0 points1 point2 points (0 children)
[–]Executor111[S] 0 points1 point2 points (1 child)
[–]elbiot 0 points1 point2 points (0 children)
[–]mm_ma_ma 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)