- Task 2 Manipulating Lists Part A Reverse Implement A Function Reverse Strings My List That Takes A List Of Strings 1 (127.23 KiB) Viewed 33 times
Task 2: Manipulating Lists Part A: Reverse Implement a function reverse_strings (my_list) that takes a list of strings,
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Task 2: Manipulating Lists Part A: Reverse Implement a function reverse_strings (my_list) that takes a list of strings,
Task 2: Manipulating Lists Part A: Reverse Implement a function reverse_strings (my_list) that takes a list of strings, and returns the strings con- catenated in reverse order. You may NOT use the method reverse. You may destroy the input list in the process. Hint: which method lets you easily remove the last element in a list? How could you create a loop that uses the fact the list is getting smaller? Example: calling reverse_strings (['my', 'little', 'pony']) returns 'ponylittlemy'. 1 Part B: Complete Implement a function complete (my_list) that takes a list of integers in ascending sorted order with no du- plicates, and inserts any missing numbers to create an unbroken sequence. The function should return the reference to the original list. The original list must be altered. Do NOT return a range object that has been converted to a list. Hint: which method lets you easily insert into a list? How could you loop through a list to find the missing numbers? Example: calling complete ([12,15,19]) alters the original list to return [12, 13, 14, 15, 16, 17, 18, 19].