-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstr_analysis.py
More file actions
42 lines (23 loc) · 811 Bytes
/
Copy pathstr_analysis.py
File metadata and controls
42 lines (23 loc) · 811 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
def main():
vowels = "aeiouAEIOU"
vowel_count = 0
print("=======Welcome to Garv's Text Analysis Tool!!=======")
text = input("Enter your text: ")
if len(text.strip()) == 0:
print('Please enter some text!')
return
for char in text:
for vowel in vowels:
if char == vowel:
vowel_count += 1
print(f"Reversed Text: {text[::-1]}")
print(f"Character Count: {len(text)}")
print(f"Word Count: {len(text.split())}")
print(f"Uppercase: {text.upper()}")
print(f"Lowercase: {text.lower()}")
print(f"Vowel Count: {vowel_count}")
print(f"First Word: {text.split()[0]}")
print(f"Last Word: {text.split()[-1]}")
print(f"Is Palindrome?: {text == text[::-1]}")
if __name__ == '__main__':
main()