Question: How to write this in Python? Write a function called fun_with_lists(1st) which takes in one parameter which is a list of strings that form a
How to write this in Python?

Write a function called fun_with_lists(1st) which takes in one parameter which is a list of strings that form a sentence. The strings that form the sentence are stored in the list in the reverse order. You need to perform the following to make sense of the sentence that the strings stored in the list form: - Reverse the list (use the reverse method) - Insert the string 'The' in the beginning of the list (at index 0) (use the insert method) - Append the string at the end of the list (use the append method) The function should return the modified list as shown in the sample outputs. Sample Input 1: ['round 'is', 'earth'] Sample Output 1: [The', 'earth', 'is', 'round', '.'] Sample Input 2: ['program', 'world', 'hello'] Sample Output 2: ('The', 'hello', 'world', 'program', '.'] Write a program, test using stdin stdout Correct answer from 288 learners Total 41% of tries are correct x It's incorrect. Failed test #1 of 3. Wrong answer This is a sample test from the problem statement! Test input: 'round 'is' 'earth'] Correct output earth', 'is', 'round', '.') Your code output: (None, None, None) Hide [The', Debug your code with your own inputs! Time limit: 15 seconds Memory limit: 256 MB 1 # Write the function definition here 2 def fun_with_lists (1st): return ist.reverse(). 1st.insert(0, "The'), 1st.append(":)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
