-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path09_Tuple.py
More file actions
59 lines (50 loc) · 968 Bytes
/
Copy path09_Tuple.py
File metadata and controls
59 lines (50 loc) · 968 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#list
a=()
print(type(a))
#type of operations
'''
1. concatenation --(addind of two numbers)
2. Iteration -- (looping of elements)
3. membership operations
4. identify operators
5. repatations operators-- repeat the tuple values
'''
'''
list allow the duplicates.. (allow different type of elements)
allow indexig and slicing
immutable
'''
#indexing
s=(23,56,89,456,63,12,'sravs')
print(s[-1])
#slicing
s=(23,56,89,456,63,12,'sravs')
print(s[0:2:4])
#min, max,length,sum,
s=(23,56,89,456,63,12)
print(min(s))
print(max(s))
print(sum(s))
print(len(s))
#concatenation--adding of elements
s1=1,2,3
t1=4,8,6
print(s1+t1)
#repetation
c=(56,89,46,78)#repating the tuple value
print(c*3)
#iteration
c=(56,89,46,78)
for i in c:
print(i)
#membership operator
#exmple:1
c=(56,89,46,78)
print(12 in c)
print(78 in c)
#example:2
s1=(56,89,46,78)
s2=(23,56,20,45)
s3=(56,89,46,78)
print(s1 is s2)
print(s1 is s3)