Python Classroom Series – 26/May/2021

Tuples and Lists

  • We have understood some of the python’s basic data types
    • Boolean’s
    • integer’s
    • Float’s
    • String’s
  • I want to store
    • my favourite holiday spot’s
    • courses which I enrolled
  • Python has two sequence structures
    • Tuple
    • lists
  • These contain zero or more elements, unlike string the elements can be of different types.
  • Why does python contain both lists and tuples?
    • Tuples are immutable
    • Lists are mutable


  • Create with Commas and () Preview
  • Tuple unpacking:
combo_meal = ('biryani', 'coke')
main_course, desert = combo_meal
  • Combining tuples using + : Preview

  • Duplicate items with * : Preview

  • Iterating over tuples: Refer Here for the example with while and for based iteration


  • Lists are good at keeping track of things/elements by their order, especially when the order and contents might change.

  • Unlike, strings or tuples lists are mutable.

  • Create with [] Preview

    • Convert to list Preview
  • Converting list to tuple Preview

  • Getting an Item by [ offset ] Preview

  • Get Items with a Slice Preview

  • Adding an item to the list with append() Preview

  • Adding an Item by offset using insert() Preview

  • Duplicate All items with * Preview

  • Combine lists using extend() or + Preview


  • Delete an item by offset with del Preview

  • Delete an Item by Value with remove Preview

  • Get and Item by Offset and Delete it with pop() Preview

  • Delete all the items with clear Preview

Lets write a Python Program to Store

  • How do you represent the following data in python (covered so far)
name phone num Qual
ram 99999999 BTech
shyam 8888888 MTech
sita 77777777 MCA
geeta 6666666 BSc
    ['ram', 99999999, 'BTech'],
    ['shyam',8888888,'Mtech' ],
    ['sita', 77777777, 'MCA'],
    ['geeta', 6666666, 'BSc'],    


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin