In the following questions you are to give a short sequence of python instructions that result in the requested operation. Do not had write this, use Notepad or Word or some other text editor. Here are the usual methods. You can use any of them as you see fit. Note I do not want you to turn in a running program although you may test you answers using python. the first is an example of what to do
1. Suppose that s=[1,2,3] and t=[4,5,6]. Create the string g = [1,2,3,4,5,6,1,2,3] from s and t. Answer: s=[1,2,3] t=[4,5,6] g = s + t + s # Here we are concatenating
2. Let s=[1,5,3,4,7,2]. Replace the 4 and 7 in the list with 9 and 8 resp.
3. Let s=[1,5,3,4,7,2]. Delete the values 5 and 7 from s so that it results in s = [1,3,4,2]
4. Let t = [1,2,3,4,5,6]. Write a loop that replaces each element of this list with the element divided by 2. Make sure that the values are float.
5. Write a loop that prints out t=[2,4,3,6,5,7,1] backwards. IE 1 7 5 …
6. Write a function that calculates and returns the average of the numbers in a list such as t=[23,13,54,32,65,46,19,... 33]
7. Write a loop that add the even numbers 2,4, … 100 to the list e. Use append to do this.
8. Create a function called Rotate(list) that will take off the first element of a list and add it to the end of the list. Return the rotated list.
9. Write a function called Midchop(list) that will remove the middle element of list if the length is odd or the two middle elements if the length is even. Return the result.
10. Suppose that I have a string line=”12 33 45 52 74 54 18 … 77″. Write a short piece of code that retrieves the integer values using the split method and then print out the largest value in the list.