List are mutable non primitive data Structures while tuple is the opposite, immutable. You make use of list when you will be modifying the contents from time to time, you use tuples when you don't need to modify it after creating it. It places a restriction and helps makes computation faster.
I am a full-stack software engineer, technical writer, and DevOps enthusiast, with a passion for problem-solving through implementation of high-quality software products.
I hold a bachelor’s degree
Tuples are immutable while lists are mutable. This for example has the effect that tuples are hashable and therefore, can be used in sets and as keys in dictionaries.
Also, this makes lists the better option when you need to addi or remove items. If you doesn't, as mentioned in the article, the tuples has lower memory footprint.
What is the difference between list and tuple? In same problem we can use either both of them?
List are mutable non primitive data Structures while tuple is the opposite, immutable. You make use of list when you will be modifying the contents from time to time, you use tuples when you don't need to modify it after creating it. It places a restriction and helps makes computation faster.
Nice explanation.
Tuples are immutable while lists are mutable. This for example has the effect that tuples are hashable and therefore, can be used in sets and as keys in dictionaries.
Also, this makes lists the better option when you need to addi or remove items. If you doesn't, as mentioned in the article, the tuples has lower memory footprint.
Ohk thanks for your warm reply