Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 16, 2020 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/8bec2924f7e1e161c06a196cc84cde65 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/8bec2924f7e1e161c06a196cc84cde65 to your computer and use it in GitHub Desktop.
t=('red','blue','green',1,2,3)
#Changing tuple to list
t1=list(t)
print (t1) #Output: ['red', 'blue', 'green', 1, 2, 3]
# Inserting items to list
t1.insert(0,'yellow')
#Converting to tuple back
t=tuple(t1)
print (t) #Output: ('yellow', 'red', 'blue', 'green', 1, 2, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment