Last active
May 13, 2025 17:24
-
-
Save abraham-ny/d0c667a88c2f95ca48c22f8b65e89aa4 to your computer and use it in GitHub Desktop.
PLP-WEEK Two assignment Py - Abraham
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Step 1: Create an empty list called my_list | |
| my_list = [] | |
| # Step 2: Append the elements 10, 20, 30, 40 to my_list | |
| my_list.append(10) | |
| my_list.append(20) | |
| my_list.append(30) | |
| my_list.append(40) | |
| # Step 3: Insert the value 15 at the second position (index 1) in the list | |
| my_list.insert(1, 15) | |
| # Step 4: Extend my_list with another list [50, 60, 70] | |
| my_list.extend([50, 60, 70]) | |
| # Step 5: Remove the last element from my_list | |
| my_list.pop() | |
| # Step 6: Sort my_list in ascending order | |
| my_list.sort() | |
| # Step 7: Find and print the index of the value 30 in my_list | |
| index_of_30 = my_list.index(30) | |
| print("The index of value 30 is:", index_of_30) | |
| # hERE I PROINTED FINAL LIST RESULT | |
| print("Final List:", my_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment