3.1.6.9 LAB: Operating with lists - basics
an anonymous user
·
Python
·

hatList = [1, 2, 3, 4, 5] # This is an existing list of numbers hidden in the hat. # Step 1: write a line of code that prompts the user # to replace the middle number with an integer number entered by the user. # Step 2: write a line of code here that removes the last element from the list. # Step 3: write a line of code here that prints the length of the existing list. print(hatList) print ("Change the middle number with an integer") #user_numbers = int(input()) hatList [2] = int(input()) print("New list content:", hatList) del hatList [4] print("Last list content:", hatList) print("\nList's length:", len(hatList))
36
Click on the Run button to get started.
The code/input has changed since you last clicked on Run. Click it
again to see the updated changes.
Comments