-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatastructures.py
More file actions
57 lines (32 loc) · 794 Bytes
/
Copy pathdatastructures.py
File metadata and controls
57 lines (32 loc) · 794 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
from collections import defaultdict
s = {(1,2,3),(5,6,7)}
n = {1,2,3,4,5,6}
g = {"string"}
boolean = {True}
print(n,g,s,boolean)
dictionairies = {
"name":"sahil",
"surname":"shaikh"
}
for key in dictionairies.keys():
print(key)
for values in dictionairies.values():
print(values)
for items in dictionairies.items():
print(items)
from collections import Counter
string = "missisipie"
print(Counter(string).most_common(2))
numbers = [1,3,4,5,6]
list_comprehension = [x*2 for x in range(5) if x > 2]
dict_comprehension = {x:x**2 for x in numbers}
set_comprehension = {x*2 for x in numbers}
print("brainpain")
list = [10, 20, 30, 40, 50]
print(list[1:3])
reverse = list[::-1]
print(list,reverse)
a, *b, c = [1, 2, 3,4,5,6,6,7]
print(a)
print(b)
print(c)