Last active
December 15, 2019 01:22
-
-
Save lfalanga/8e73a2a462dde82cc114768f75766b96 to your computer and use it in GitHub Desktop.
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
| # Example 1: Python3 program for pop() method | |
| list1 = [ 1, 2, 3, 4, 5, 6 ] | |
| # Pops and removes the last element from the list | |
| print(list1.pop()) | |
| # Print list after removing last element | |
| print("New List after pop : ", list1, "\n") | |
| list2 = [1, 2, 3, ('cat', 'bat'), 4] | |
| # Pop last three element | |
| print(list2.pop()) | |
| print(list2.pop()) | |
| print(list2.pop()) | |
| # Print list | |
| print("New List after pop : ", list2, "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment