
my_tuple = (1, 2, 3)Example:
numbers = (10, 20, 30)
print(numbers[0]) # Output: 10
Example:
colors = ("red", "blue", "green")
colors[0] = "yellow" # β Error: 'tuple' object does not support item assignment
Why immutability matters:
| Feature | Tuple | List |
|---|---|---|
| Syntax | ( ) |
[ ] |
| Mutable? | β No | β Yes |
| Performance | Faster | Slower |
| Use as dict key | β Yes | β No |
point = (4, 5)
locations = {("Paris", "France"): "Eiffel Tower"}
def divide(a, b):
return a // b, a % b
quotient, remainder = divide(10, 3)
Fill out the Get Help form and our team will contact you.
We accept UPI, Debit/Credit Cards, and Net Banking.
Yes, installment options are available for selected courses.
Yes, we provide resume and interview support.