Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
23 changes: 23 additions & 0 deletions Number-Guess/TextAnalyzer/Text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from collections import Counter

def analyze_text(text):
words = text.split()
total_words = len(words)
total_chars = len(text)
total_no_spaces = len(text.replace(" ", ""))

most_common_word = Counter(words).most_common(1)[0]

print("\n📊 Text Analysis Results:")
print(f"➡️ Total words: {total_words}")
print(f"➡️ Total characters (with spaces): {total_chars}")
print(f"➡️ Total characters (without spaces): {total_no_spaces}")
print(f"➡️ Most used word: '{most_common_word[0]}' ({most_common_word[1]}x)")

def main():
print("🧠 Text Analyzer — Python Project")
text = input("Enter or paste the text you want to analyze:\n\n")
analyze_text(text)

if __name__ == "__main__":
main()