-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
100 lines (77 loc) · 1.5 KB
/
test.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# first=int(input("enter first:")) //power
# print(first**2)
""" list1=[1,2,3] //pallindrome
copy1=list1.copy()
copy1.reverse()
if(copy1==list1):
print("pallin")
else:
print("not")
list=["A","B", "C","A"]
a=list.count("A")
print(a)
b=list.sort()
print(list)
van={ #dictionary
"name" : "vanshika",
"sub":["coa","m4","python"],
"num":{ #nested dict
"phy":92,
"chem":77
}
"year":2,
"age":19,
"isadult" :True
}
print(van)
print(type(van))
print(van["year"])
van["name"]="leena"
print(van["num"]["chem"])
print(len(van))
pairs=list(student.items())
print(pairs[2])
print(student.get("van"))
student.update({city:prayagraj})
print(student)
#print(stu["name2"]) error
print(stu.get("name2")) none
print(stu.keys())
print(list(stu.keys()))
print(stu.values())
print(list(stu.values()))
print(stu.items()) #tuples
null_dict={}
null_dict["name"]="priya"
print(null_dict)
set={2,5,3,"dvc","ghn",3,3}
print(set)
print(type(set))
print(len(set))
coll=set() #empty set
coll.add(1)
coll.add(2)
coll.add(3)
coll.pop()
print(coll)
coll.remove(2)
coll.clear()
print(coll)
set1={3,6,2,1,6}
set2={2,9,5,31,5}
print(set1.union(set2))
print(set1.intersection(set2))
i=1
while i<10:
print(3*i)
i+=1
list=[12,45,7,3,9]
tuple=()
for val in list:
print(val)
for i in range(5): # stop*
print(i)
for i in range(5,9,2): #start stop* step
print(i)
for el in range(2):
pass #to skip"""