Variable_name = (element1,element 2,…..)







classmates = ("Karan","sumit","amit")

print(classmates)

classmates[1] = "Tarun"

print(classmates)














('Karan', 'sumit', 'amit')
Traceback (most recent call last):
  File "C://python/datatype.py", line 5, in <module>
    classmates[1] = "Tarun"
TypeError: 'tuple' object does not support item assignment









tuple = ("Banana","Orange","Grapes","Straw berry")

x= 0

while x < 4:
    print(tuple[x])
    x = x + 1











tuple = ("Banana","Orange","Grapes","Straw berry")

print(tuple[1:3])







Posted By  -  Karan Gupta
 
Posted On  -  Thursday, February 14, 2019
 
Updated On  -  Thursday, February 21, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250