-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path1.Basic_of_tuple.py
More file actions
34 lines (23 loc) · 883 Bytes
/
1.Basic_of_tuple.py
File metadata and controls
34 lines (23 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##------------------------------------------------------------------------------------------------------
#Created By:Ravishankar Chavare
#version:python 3.7
#Date:13/03/2019
#File_des:Introduction of Tuple Data Structure
##------------------------------------------------------------------------------------------------------
'''
-A tuple is a collection which is ordered and unchangeable.
-In Python tuples are written with round brackets.
'''
#Create A blank Tuple
blanktuple=() #you can also use blanktuple=tuple()
print(type(blanktuple))#Print the type of above object
#Create A tuple with 5 element
elements=(1,2,3,4,5,6,7)
print(elements) #printing the Element
#Accessing Tuple
#Accessing first element
firstelement=elements[1]
print(firstelement)
#Changing the first element
elements[1]=9 #TypeError: 'tuple' object does not support item assignment
print(elements)