-
Notifications
You must be signed in to change notification settings - Fork 1
/
6_list.py
61 lines (38 loc) · 935 Bytes
/
6_list.py
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
# List
# list use []
# tuple use ()
newvar = [1,2,3,4,5,6,7,8]
newvar[0] = 111
print('\nnewvar: ', newvar);exit()
newvar = (1,2,3,4,5,6,7,8)
print('''
helajhdla
sjdfkak
kjasdkfah
jsakjfdsk
''')
# List
mylist = [1,2,3,4,5,6,7,8]
mylist.append([1,2,3,4])
mylist = [
[1,2,3,4,[1,2,3,4,5]],
(2,3,4,5,6,[1,2,3,4,5],8),
{'name':'Daksh','data':[1,2,3,4,5]},
]
print('\nmylist: \n',mylist ,'\n')
print('\nDetail: ', mylist[2])
# Casting: type casting: data type change
print('\nType of mylist: ', type(mylist))
# casting of list to tuple
listToTuple = tuple(mylist)
print('\nType of listtotuple: ', type(listToTuple))
# list to tuple then tuple to list
tupletolist = list(tuple(mylist))
print('\ntupletolist: ', type(tupletolist))
# Home work:
# Chek all methods of list and tuple
# list methods 11
# tuple methods 2
# Dict / set
# Programming me 4 works hote hai:
# CREATE | VIEW | UPDATE | DELETE