🏠 Home 📚 Chapters 💻 Projects ℹ️ About
HomeProjects › Day 13
DAY 13 — 60 DAY PYTHON CHALLENGE

💻 Vowel Counter

Python में Vowel Counter — स्वर अक्षर गिनें

Advertisement

Project kya hai?

Day 13 ka project hai Vowel Counter! Neeche complete code hai — copy karo aur chalao!

Complete Python Code

python — vowel.py
def count_vowels(text):
    vowels = "aeiouAEIOU"
    counts = {v.lower(): 0 for v in "aeiou"}
    total  = 0
    for char in text:
        if char in vowels:
            counts[char.lower()] += 1
            total += 1
    return counts, total

def count_consonants(text):
    return sum(1 for c in text if c.isalpha() and c.lower() not in "aeiou")

print("=== Vowel Counter ===")
while True:
    print("
1. Text analyze karo")
    print("2. Multiple texts compare karo")
    print("3. Baahar jao")
    ch = input("Choice: ")
    if ch == "1":
        text  = input("Text enter karo: ")
        vc, total = count_vowels(text)
        cons  = count_consonants(text)
        total_alpha = sum(1 for c in text if c.isalpha())
        print(f"
Results:")
        print(f"  Total characters : {len(text)}")
        print(f"  Letters          : {total_alpha}")
        print(f"  Vowels           : {total}")
        print(f"  Consonants       : {cons}")
        print(f"
  Vowel breakdown:")
        for v, c in vc.items():
            bar = "#" * c
            print(f"    {v}: {bar} ({c})")
    elif ch == "2":
        t1 = input("Text 1: ")
        t2 = input("Text 2: ")
        _, v1 = count_vowels(t1)
        _, v2 = count_vowels(t2)
        print(f"  Text 1 vowels: {v1}")
        print(f"  Text 2 vowels: {v2}")
        winner = "Text 1" if v1 > v2 else "Text 2" if v2 > v1 else "Barabar"
        print(f"  Zyada vowels: {winner}")
    elif ch == "3":
        break
OUTPUT
Text: Hello Python World
Results:
  Total characters : 18
  Letters          : 15
  Vowels           : 5
  Consonants       : 10

  Vowel breakdown:
    a: (0)
    e: ## (2)
    i: (0)
    o: ## (2)
    u: (0)

Code kaise kaam karta hai?

Dictionary comprehension se vowel counts track hote hain. isalpha() se sirf letters count hote hain. Har vowel ka alag count aur bar chart dikhata hai.
Advertisement

📋 Project ka Introduction

Vowel Counter Python ka Day 13 ka project hai. Is project mein aap Python ke important concepts practice karenge jo real-world applications mein bahut use hote hain.

Yeh project beginners ke liye design kiya gaya hai lekin kaafi concepts cover karta hai. Step by step samjho, code chalao, aur khud modify karke practice karo.

Is tarah ke projects banane se aapka Python confidence badh jaata hai aur aap asli problems solve karna seekh jaate hain. Chaliye code samjhte hain!

🧠 Is Project mein kya seekhoge?

Yeh project banate waqt aap ye Python concepts use karoge:
ConceptKya karta hai
VariablesData store karna
FunctionsReusable code blocks
LoopsRepeat karna
ConditionsDecisions lena
Input/OutputUser se interact karna

📝 Code kaise kaam karta hai — Step by Step

Neeche code ki poori logic step-by-step samjhayi gayi hai:
  1. Problem samjho: Vowel Counter mein kya karna hai
  2. Required variables aur data structures decide karo
  3. Logic step-by-step likhó
  4. Code mein implement karo
  5. Test karo aur bugs fix karo

⚠️ Common Mistakes — Bhool mat jaana!

Beginners yeh galtiyan aksar karte hain — dhyan rakho:
  • ⚠️ Indentation sahi rakho — Python mein spaces matter karti hain
  • ⚠️ Variables ko use se pehle define karo
  • ⚠️ Input ko int()/float() mein convert karo agar number chahiye
  • ⚠️ Edge cases handle karo — kya hoga agar user galat input de?

🏋️ Practice Exercises — Aage badho!

Yeh project complete karne ke baad in exercises se practice karo:
  • 💡 Vowel Counter mein naya feature add karo
  • 💡 Code ko functions mein refactor karo
  • 💡 Error handling improve karo
  • 💡 File mein data save karo

❓ Aksar Pooche Jane Wale Sawal (FAQ)

Q: Vowel Counter project kyon banana chahiye?

A: Har project ek naya concept sikhata hai. Practice se hi Python fluent aati hai.
Q: Code run nahi ho raha?

A: Indentation check karo, syntax errors dekho, variables define hain ya nahi check karo.
Q: Kaise improve karein?

A: Pehle basic version complete karo, phir ek ek feature add karte jao.
🏠 📋 Projects Day 14 →