Add exercises that were initially left out
This commit is contained in:
parent
129e74cbf4
commit
bf78a613d3
3 changed files with 36 additions and 0 deletions
10
thinkcspy/Chapter-16-Exercises/Problem2_reverseList.py
Normal file
10
thinkcspy/Chapter-16-Exercises/Problem2_reverseList.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Runestone.Academy thinkcspy course
|
||||
# Chapter 16
|
||||
# Problem 2
|
||||
|
||||
def reverseList(lst):
|
||||
if len(lst) == 1:
|
||||
return lst
|
||||
else:
|
||||
lst = [lst[-1]] + reverseList(lst[:-1])
|
||||
return lst
|
||||
Loading…
Reference in a new issue