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

💻 Word Scramble

Python में Word Scramble Game — शब्द उलझन खेल

Advertisement

Project kya hai?

Day 28 ka project hai Word Scramble! Neeche complete code hai — copy karo aur chalao!

Complete Python Code

python — scramble.py
import random

words = [
    ("python",     "Ek programming language"),
    ("computer",   "Electronic device"),
    ("keyboard",   "Typing device"),
    ("internet",   "Global network"),
    ("algorithm",  "Problem solving steps"),
    ("variable",   "Value store karne ka naam"),
    ("function",   "Reusable code block"),
    ("database",   "Data store karne ki jagah"),
    ("software",   "Computer program"),
    ("hardware",   "Physical computer parts"),
]

def scramble(word):
    letters = list(word)
    while True:
        random.shuffle(letters)
        scrambled = "".join(letters)
        if scrambled != word:
            return scrambled
    return scrambled

score  = 0
total  = 5
played = random.sample(words, total)

print("=== Word Scramble Game ===")
print(f"Score 0/{total}
")

for i, (word, hint) in enumerate(played, 1):
    sc = scramble(word)
    print(f"Q{i}: Scrambled word: {sc.upper()}")
    print(f"     Hint: {hint}")
    print(f"     ('{word[0].upper()}' se shuru hota hai, {len(word)} letters)")
    ans = input("     Answer: ").lower().strip()
    if ans == word:
        print(f"     SAHI! '{word}' correct hai!
")
        score += 1
    else:
        print(f"     Galat! Sahi word tha: '{word}'
")

print(f"=== Result: {score}/{total} ===")
pct = score/total*100
print(f"Percentage: {pct:.0f}%")
if pct == 100:  print("Perfect score! Shabash!")
elif pct >= 60: print("Accha kiya! Aur practice karo.")
else:           print("Thodi aur practice chahiye!")
OUTPUT
=== Word Scramble Game ===

Q1: Scrambled: NOHTYP
    Hint: Ek programming language
    'P' se shuru, 6 letters
    Answer: python
    SAHI! 'python' correct hai!

=== Result: 4/5 ===
Percentage: 80%
Accha kiya!

Code kaise kaam karta hai?

random.shuffle() se word scramble hota hai. Loop check karta hai ki scrambled != original. random.sample() se har baar alag words milte hain.
Advertisement

📋 Project ka Introduction

Word Scramble Game Python ka Day 28 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: Word Scramble Game 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:
  • 💡 Word Scramble Game 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: Word Scramble Game 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 29 →