Created
November 16, 2020 05:49
-
-
Save sshehrozali/24a885c3dadbee9f0665ff7b3bf0c49d to your computer and use it in GitHub Desktop.
Student's Exercise (Lab 3)
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
# Student Exercise (Lab 3) # Performed By Syed Shehroz Ali | |
# List of months | |
monthsL = ["Jan", "Feb", "Mar", "May"] | |
# Tuple of months | |
monthsT = ("Jan", "Feb", "Mar", "May") | |
# List exercise # | |
# Insert in list | |
monthsL.insert(3, "Apr") | |
print("Insert: ", monthsL) | |
# Append the list | |
monthsL.append("Jun") | |
print("Append:", monthsL) | |
# Pop ith item in list | |
monthsL.pop(1) | |
print("Pop: ", monthsL) | |
# Reverse the list | |
monthsL.reverse() | |
print("Reverse: ", monthsL) | |
# Sort the list | |
monthsL.sort() | |
print("Sort: ", monthsL) | |
# Tuple exercise # | |
# Since Python Tuples are immutable so they doesn't support any of these list methods. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment