From 7e116e273cb3281bfed75eeb543e91ea5effb6cf Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 8 Aug 2020 14:58:02 +0300 Subject: [PATCH] Update python lists and tuples --- blog_posts/python-lists-tuples.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/blog_posts/python-lists-tuples.md b/blog_posts/python-lists-tuples.md index a3310c73b..634f58c1a 100644 --- a/blog_posts/python-lists-tuples.md +++ b/blog_posts/python-lists-tuples.md @@ -13,7 +13,6 @@ excerpt: Learn how Python's lists and tuples are different and level up your cod - Contained elements are mutable (can be changed after creation) - Lists have a variable length - A list takes up more memory than a tuple -- Can only store homogenous elements (of the same type) **Tuples** @@ -21,10 +20,9 @@ excerpt: Learn how Python's lists and tuples are different and level up your cod - Contained elements are immutable (cannot be changed after creation) - Tuples have a fixed length - A tuple takes up less memory than a list -- Can store heterogenous elements (of different types) **When to use each one** -Lists provide a more accessible API and should be used whenever similar types of objects need to be stored and are expected to change over the course of the application's execution. On the other hand, tuples should be used for immutable and heterogenous data, behaving more like constants than variables. +Lists provide a more accessible API and should be used whenever similar types of objects need to be stored and are expected to change over the course of the application's execution. On the other hand, tuples should be used for immutable data, behaving more like constants than variables. **Image credit:** [Hasan Almasi](https://unsplash.com/@hasanalmasi?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/code?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)