Question: Using Python, thank you so much! Index Slicing 1. Create a new variable longlist and assign it the value of numberlist + itemlist. 2. Print


![of the following sub-groups (sub-headings): a. len(longlist) b. longlist [:) ] c.](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/10/6703fe9b96281_0356703fe9b304fb.jpg)
Index Slicing 1. Create a new variable longlist and assign it the value of numberlist + itemlist. 2. Print the following values below and write your observation for each of the following sub-groups (sub-headings): a. len(longlist) b. longlist [:) ] c. longlist[:9] d. longlist[:] e. longlist[1:) f. longlist[2:] Index Slicing with Range 9. longlist[2:5] h. longlist[5:2] i. longlist[8:] j. longlist[9:] Index Slicing using Negative Indices k longlist[-9:] 1. longlist(-8:] m. longlist[-8:-7] n. longlist(-1:] Other properties of Index Slicing o. longlist[10:20] p. longlist[-7:5) Index Slicing with Step parameter q. longlist[:1) r. longlist[::2] S. longlist[1:8:2] t longlist[9:1:-1) u. longlist[-1:1) V. longlist[-1:-1) 3. Write your main observation about index slicing as a whole. List Methods and the Mutable Property of Lists 1. Create a new variable numberlist and assign it to be equal to numberlist. 2. Print the value of numberlist. 3. Print the value of numberlist2. 4. Assign the value of numberlist[0] to be equal to 6. 5. Print the value of numberlist. 6. Print the value of numberlist2. 7. Observe how numberlist2 is affected by changes in numberlist due to the assignment. 8. Change the value of numberlist2 and assign it the value of numberlist.copy 9. Print the value of numberlist2 10. Assign the value of numberlist[O] to be equal to 5. 11. Print the value of numberlist. 12. Print the value of numberlist2. 13. Write your observation about the immutable property and the difference of assigning numberlist2 to be equal to numberlist and the numberlist.copy() method. Exploring some List Functions and Methods 1. Print the value of numberlist 2. Run the command numberlist.append(6) 3. Print the value of numberlist 4. Run the command numberlist.pop() 5. Print the value of numberlist 6. Run the command numberlist.sort() 7. Print the value of numberlist 8. Run the command itemlist.sort() 9. Print the values: min(numberlist) and max(numberlist) 10. Print the value of longlist 11. Print the value of longlist.count(1) 12. Print the value of longlist[7].count(1) The in operator 1. Type the code as shown: print(3 in longlist) 2. Type the code as shown: print(15 in longlist) 3. Type the code as shown below: num = int(input("Enter a number: ")) if num in longlist: print("The number is in longlist") else: print("The number is not in longlist") 4. Write your observations on the in operator. Using a list in an iterative statement 1. Type the code as shown below: for item in longlist: print(item) 2. Type the code as shown below: i=0 while i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
