
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How can I represent immutable vectors in Python?
You can use tuples to represent immutable vectors in Python. Tuples are immutable data structures that behave like a list but maintain order and are faster than lists.
example
myVec = (10, 15, 21) myVec[0] = 10
This will produce an error as tuples can't be mutated.
- Related Articles
- How can I represent an infinite number in Python?
- How can I represent python tuple in JSON format?
- How can we change the id of an immutable string in Python?
- Python tuples are immutable then how we can add values to them?
- How can text data be embedded into dimensional vectors using Python?
- How can a Python subclass control what data is stored in an immutable instance?
- How to implement immutable Data structures in Python?
- What is immutable in Python?
- How to plot vectors in Python using Matplotlib?
- How can I do "cd" in Python?
- How Can I Run Python in Atom?
- How can we represent vector quantities ?
- How can I use Multiple-tuple in Python?
- Which data types are immutable in Python?
- Difference between mutable and immutable in python?

Advertisements