Python Essentials Classroom Series – 10/Sept/2021

Tuples and Lists

  • So far we have worked with some basic python data types
    • booleans
    • integers
    • floats
    • strings
  • Most computer languages represent a sequence of times indexed by their position (like strings)
  • Python has two other sequence structures: tuples and lists
  • These sequences contain zero or more elements, unlike string each element can be of different type
  • Why does python contain both lists and tuples?
    • Tuples are immutable and lists are mutable

Tuples

Lists

  • Lists are good for keeping track of things by their order, especially when the order and contents might change
  • Unlike tuples, lists are mutable, You can change list in place, add new elements, delete or replace existing elements
  • Refer Here for the samples done in the class.

Leave a Comment

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

About learningthoughtsadmin