Repository navigation
Expand file tree
/
Copy pathtuple.py
More file actions
63 lines (54 loc) · 1.34 KB
/
Copy pathtuple.py
File metadata and controls
63 lines (54 loc) · 1.34 KB
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
60
61
62
'''t1=(1,2,32,4,6,7,8,9,10)
l1=[]
for i in t1:
l1.append(i)
l1.append("manush")
print(l1)
t2=tuple(l1)
print(t2)
'''
'''t1=(1,1,2,2,2,3,3,3,3,3,4,4,4,5)
l1=[]
for i in t1:
if i not in l1:
l1.append(i)
t2=tuple(l1)
print(t2)
'''
# input :[(10,20,30), (40,50,60), (70,80,90)]
# output : [(10,20,100), (40,50,100), (70,80,100)]
'''lt1=[(10,20,30),(40,50,60),(70,80,90)]
lt2=[]
for i in lt1:
i=list(i)
i[-1]=100
i=tuple(i)
lt2.append(i)
print(lt2)
'''
# Write a Python program to check if a specified element appears in a tuple of tuples.
# Original list:
# (('Red', 'White', 'Blue'), ('Green', 'Pink', 'Purple'), ('Orange', 'Yellow', 'Lime'))
# Check if White presenet in said tuple of tuples!
# True
# Check if White presenet in said tuple of tuples!
# True
# Check if Olive presenet in said tuple of tuples!
# False
'''t1=(('Red', 'White', 'Blue'), ('Green', 'Pink', 'Purple'), ('Orange', 'Yellow', 'Lime'))
a=input("Enter a colour:")
flag="False"
for i in t1:
i=list(i)
print(i)
for j in i:
if a==j:
flag="True"
if flag=="True":
print("True")
else:
print("False")
'''
# Write a Python program to sort a tuple by its float element.
# Sample data: [('item1', '12.20'), ('item2', '15.10'), ('item3', '24.5')]
# Expected Output: [('item3', '24.5'), ('item2', '15.10'), ('item1', '12.20')]