-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtuple.py
More file actions
56 lines (44 loc) · 801 Bytes
/
tuple.py
File metadata and controls
56 lines (44 loc) · 801 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
t=123,321,'Python'
print(t)
new_t=t,(451,456,'Hello')
print(new_t)
l=[1,2,3]
mix_tuple=(new_t,l)
print(mix_tuple)
t[0]=100
blank_t=()
len(blank_t)
single_t=('Hello')
len(single_t)
#packing
julia = ("Julia", "Roberts", 1967, "Duplicity", 2009, "Actress", "Atlanta, Georgia")
print(julia)
julia = julia[:3] + ("Eat Pray Love", 2010) + julia[5:]
print(julia)
def fn():
julia = julia[:3] + ("Eat Pray Love", 2010) + julia[5:]
print(julia)
#unpacking
(name, surname, b_year, movie, m_year, profession, b_place) = julia
print(name)
print(profession)
#concat
even_t=(2,4,6,8)
odd_t=(3,5,7,9)
sum_t=even_t+odd_t
#repeat
t=('Hello',)
t=t*4
print(t)
#in ops
flag=4 in even_t
print(flag)
-_
#loop
for e in sum_t:
print(e)
t=(1,2,3,4)
print(max(t))
print(min(t))
l=[4,7,0,3]
t=tuple(l)