-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew2.py
More file actions
91 lines (75 loc) · 1.93 KB
/
Copy pathnew2.py
File metadata and controls
91 lines (75 loc) · 1.93 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
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
import matplotlib.pyplot as plt
import numpy as np
#باز کردن فايل اصلي تکست
fp=open('Projects.txt','r')
text=fp.read().lower()
fp.close()
words=text
# نمايش طول ليست کلمات اصلي
print('len(text) : ',len(text))
print('len(words) : ',len(words))
### words=input('input: ')
voices=['a','b','c','d','f','g','h','j','e','i','o','u','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
found=dict()
found['a']=0
found['b']=0
found['c']=0
found['d']=0
found['e']=0
found['f']=0
found['g']=0
found['h']=0
found['i']=0
found['j']=0
found['k']=0
found['l']=0
found['m']=0
found['n']=0
found['o']=0
found['p']=0
found['q']=0
found['r']=0
found['s']=0
found['t']=0
found['u']=0
found['v']=0
found['w']=0
found['x']=0
found['y']=0
found['z']=0
for letter in words:
if letter in voices:
found[letter]+=1 #اين قسمت کار شمارش کاراکترها رو انجام ميده
else:
pass
else:
print('finished!')
print('=========')
i=0
for key ,value in found.items():
if i<9 :
if value <10:
print(i+1 ,'----', key,'was found ',value,' time(s).')
elif value <100:
print(i+1 ,'----', key,'was found ',value,' time(s).')
elif value <1000:
print(i+1 ,'----', key,'was found ',value,' time(s).')
elif value<10000:
print(i+1 ,'----', key,'was found ',value,' time(s).')
else:
if value<10:
print(i+1 ,'---', key,'was found ',value,' time(s).')
elif value<100:
print(i+1 ,'---', key,'was found ',value,' time(s).')
elif value<1000:
print(i+1 ,'---', key,'was found ',value,' time(s).')
elif value<10000:
print(i+1 ,'---', key,'was found ',value,' time(s).')
i+=1
j=0
list1=[]
list2=found.values()
list1.append(found.values())
print (list1)
arr=np.array(list(list1))
print (arr[0:1])