How to set up a tuple:
Tuples are wrapped in parentheses, and the elements in parentheses are separated by commas to indicate that this is a tuple.
A tuple differs from a list in that the elements inside a tuple cannot be modified.
A= (a)
Tuples Common operations:
Tuple function: Take a sequence as an argument and convert it to a tuple
a=[1,2,3]# list c=tuple (a)print(c)#( a) result
Access tuples: You can use the subscript index to access the values in the tuple
A= (1,2,3,4,5,6)print(a[4])# results
Connecting tuples: element values in tuples are not allowed to be modified, but they can be combined to join groups of tuples
A= ('md','FK') b= (up to) C=a+b Print(c) ('md','FK', up) # Results
Delete tuples: Values in tuples do not allow individual deletions, but you can use the DEL statement to delete an entire tuple
A= (a)del aprint(a)# result Error
Tuple intercept: Use an index to intercept values in a segment of a tuple
A= (1,2,3,4,5,6)print(A[2:5])# intercept starting at index 2 (including values on index 2) to end of index 5 (does not intercept values on index 5)(3, 4, 5) # Results
(Self-hing Artificial intelligence) Pythony tuple