Files
  • main.py
main.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import time

print("""
 _ _ _           _ _____         _                 
| | | |___ ___ _| |  _  |___ ___| |_ _ ___ ___ ___ 
| | | | . |  _| . |     |   | .'| | | |- _| -_|  _|
|_____|___|_| |___|__|__|_|_|__,|_|_  |___|___|_|  
                                  |___|            
""")

### CAPS DETECTION

time.sleep(2)

print('\n\n\n\n\n\n\n\n')

word = input('Word: ')


print("""
---
CHARACTER ANALYSIS STATS:

""")


worddict_cl = {}


wordsplit_cl = word.split(' ')
wordspaces_cl = ''.join(wordsplit_cl)

lettz = []

for i in range(len(wordspaces_cl)):
  wspace = wordspaces_cl[i]
  lettz.append(wspace)


# CAPITAL
capital = 0
lowercase = 0

i = 0

for i in range(0, len(lettz)):
  t_fc = str(lettz[i] in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
  t_fl = str(lettz[i] in 'abcdefghijklmnopqrstuvwxyz')
  
  if t_fc == 'True':
    capital += 1
    
  if t_fl == 'True':
    lowercase += 1




word = word.lower()
worddict = {}


wordsplit = word.split(' ')
wordspaces = ''.join(wordsplit)

for i in range(len(wordspaces)):
    wordi = wordspaces[i]
    if wordi in worddict:
        worddict[wordi] += 1
    else:
        worddict[wordi] = 1


for key, value in sorted(worddict.items()):
    print(key, ':', value)


vowels = ['a', 'e', 'i', 'o', 'u']
constants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']

vcdict = {'vowels': 0, 'constants': 0}

for key in sorted(worddict.keys()):
    if key in constants:
        vcdict['constants'] += worddict[key]
    if key in vowels:
        vcdict['vowels'] += worddict[key]


for key, value in sorted(vcdict.items()):
    if key == 'constants':
        cons = value
        print(key, '      :', value)
    if key == 'vowels':
        vows = value

print(key, '         :', value)

# CAPITAL 2

print('capital         :', capital)
print('lowercase       :', lowercase)


print('characters      :', cons + vows)

# PUNCTUATION

punctuation = ['.', ',', '"', '\'', '<', '>', '/', '!', '?', '@', '#', '%', '^', '&', '*', '(', ')', '-', '_', '+', '=', '{', '}', '[', ']', '|']

punct = 0

i = 0
for i in range(0, len(punctuation)):
    if worddict.get(str(punctuation[i])) is not None:
        punct += worddict[str(punctuation[i])]

print('punctuation     :', punct)

# NUMBERS
numb = 0

for i in range(0, 10):
    if worddict.get(str(i)) is not None:
        numb += worddict[str(i)]


print('numbers         :', numb)

# SPACES
print('spaces          :', len(word)-len(wordspaces))

# WORD AMOUNT
print('word amount     :', len(wordsplit))

# EXCLUDING SPACES
print('length - spaces :', len(wordspaces))

# INCLUDING SPACES
print('length + spaces :', len(word))