-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProje(Data structure).py
65 lines (56 loc) · 2.01 KB
/
Proje(Data structure).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
# for lists
list_methods=[]
for method in dir(list):
if method.startswith("__"): # python-un xususi funksiyalarini elave etmesin
continue
list_methods.append(method)
# for set
set_methods=[]
for method in dir(set):
if method.startswith("__"): # python-un xususi funksiyalarini elave etmesin
continue
set_methods.append(method)
# for tuple
tuple_methods=[]
for method in dir(tuple):
if method.startswith("__"): # python-un xususi funksiyalarini elave etmesin
continue
tuple_methods.append(method)
# for string
string_methods=[]
for method in dir(str):
if method.startswith("__"): # python-un xususi funksiyalarini elave etmesin
continue
string_methods.append(method)
# for dictionary
dict_methods=[]
for method in dir(dict):
if method.startswith("__"): # python-un xususi funksiyalarini elave etmesin
continue
dict_methods.append(method)
adlar=["List Methods","Set Methods","Tuple Methods","String Methods","Dict Methods"]
classes=[list_methods,set_methods,tuple_methods,string_methods,dict_methods]
max_len=0
for class1 in classes:
if len(class1)>=max_len: # en cox funksiyali methoda esasen cap etmek
max_len=len(class1)
with open("data.txt","w") as data:
for ad in adlar:
print(ad,end="") # title-lari cap etmek
print(" "*(30-len(ad)),end="")
data.write(ad)
data.write(" "*(30-len(ad)))
for i in range(max_len):
print()
data.write("\n")
for class1 in classes:
if i>=len(class1):
print("-------",end="")
print(" "*23,end="")
data.write("-------")
data.write(" "*23)
else:
print(class1[i],end="")
print(" "*(30-len(class1[i])),end="") # seliqeli gorunus ucun
data.write(class1[i])
data.write(" "*(30-len(class1[i])))