
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between a python list and a tuple?
The key difference between a list and a tuple is that tuples are immutable. This means that you cannot change the values in a tuple once you have created it. So if you're going to need to change the values use a List.
Benefits of using tuples −
They help in slight performance improvement.
As a tuple is immutable it can be used as a key in a dictionary.
If you can't change it neither can anyone else, which is to say you don't need to worry about any API functions etc. changing your tuple without being asked.
They take up less space than lists.
You can read more about the differences between lists and tuples in Python here − http://news.e-scribe.com/397
- Related Questions & Answers
- What is the difference between a python tuple and a dictionary?
- Difference Between List and Tuple in Python
- What is the difference between a python list and an array?
- What is the difference between a python module and a python package?
- What is the difference between a list and an array in C#?
- What is the difference between working of append and + operator in a list in Python?
- What is the difference between a method and a function?
- What is the difference between a++ and ++a in JavaScript?
- What is the difference between a simile and a metaphor?
- What is the difference between a string and a byte string in Python?
- What is the difference between list and dictionary in C#?
- What is the difference between List and IList in C#?
- What is the difference between the country and a continent?
- What is the Difference Between a Block chain and a Database?
- What is the difference between = and == operators in Python?
Advertisements