Python Material
Python Material
my_list = [1, 2, 3]
print(my_list)
# Modify the list by changing an element
my_list[0] = 10
2nd file
my_string = "Hello"
# Trying to modify a string directly will create a new string
new_string = my_string.replace("H", "h")
#Tuple Example
my_tuple = (1, 2, 3) # Attempting to modify a tuple will raise an error
#my_tuple[0] = 10 # TypeError: 'tuple' object does not support item assignment
num = 10
# You can't change the value of the original integer directly.
num += 5 # This creates a new integer with the value 15
print(num) # Output: 15 (a new integer object is created)