Skip to content

Instantly share code, notes, and snippets.

@sshehrozali
Created November 16, 2020 05:49
Show Gist options
  • Save sshehrozali/24a885c3dadbee9f0665ff7b3bf0c49d to your computer and use it in GitHub Desktop.
Save sshehrozali/24a885c3dadbee9f0665ff7b3bf0c49d to your computer and use it in GitHub Desktop.
Student's Exercise (Lab 3)
# 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