We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 55eb126 commit 083a7a1Copy full SHA for 083a7a1
2 files changed
Number-Guess/TextAnalyzer/README.md
Number-Guess/TextAnalyzer/Text.py
@@ -0,0 +1,23 @@
1
+from collections import Counter
2
+
3
+def analyze_text(text):
4
+ words = text.split()
5
+ total_words = len(words)
6
+ total_chars = len(text)
7
+ total_no_spaces = len(text.replace(" ", ""))
8
9
+ most_common_word = Counter(words).most_common(1)[0]
10
11
+ print("\n📊 Text Analysis Results:")
12
+ print(f"➡️ Total words: {total_words}")
13
+ print(f"➡️ Total characters (with spaces): {total_chars}")
14
+ print(f"➡️ Total characters (without spaces): {total_no_spaces}")
15
+ print(f"➡️ Most used word: '{most_common_word[0]}' ({most_common_word[1]}x)")
16
17
+def main():
18
+ print("🧠 Text Analyzer — Python Project")
19
+ text = input("Enter or paste the text you want to analyze:\n\n")
20
+ analyze_text(text)
21
22
+if __name__ == "__main__":
23
+ main()
0 commit comments