Skip to content

Commit bfb17cd

Browse files
authored
Merge pull request #45 from RameezHiro/Rameez
Add Word Scramble game
2 parents 47ef23a + b8cd273 commit bfb17cd

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

Python/Quiz Game/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ Displaying formatted output
2626

2727
📚 Author
2828

29-
Developed by RAMEEZ as a beginner Python project to improve interactive programming skills and logical thinking.
29+
Developed by RameezHiro as a beginner Python project to improve interactive programming skills and logical thinking.

Python/Quiz Game/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
print('Welcome to AskPython Quiz')
22

3+
34
answer=input('Are you ready to play the Quiz ? (yes/no) :')
45
score=0
56
total_questions=3
@@ -27,6 +28,7 @@
2728
else:
2829
print('Wrong Answer :(')
2930

31+
3032
print('Thankyou for Playing this small quiz game, you attempted',score,"questions correctly!")
3133

3234
mark=(score/total_questions)*100

Python/Word_Scramble/Readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🔤 Word Scramble Game
2+
3+
A fun and simple Python word puzzle game where you have to guess the original word from its scrambled version!. This project is great for beginners who want to practice loops, conditionals, functions, and randomization in Python.
4+
5+
6+
🎮 Game Description
7+
8+
The program randomly selects a word from a predefined list.
9+
It then scrambles the letters of the word and displays it to the player.
10+
The player has 3 attempts to guess the correct word.
11+
The game ends when the player guesses correctly or runs out of attempts.
12+
13+
14+
🧩 Features
15+
16+
✅ Randomly selects and scrambles words
17+
✅ Limited attempts for guessing (default: 3)
18+
✅ Provides feedback after each guess
19+
✅ Displays the correct word if the player fails

Python/Word_Scramble/main.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import random
2+
3+
4+
def scramble_word(word):
5+
return "".join(random.sample(word, len(word)))
6+
7+
words = ["python", "developer", "programming", "challenge"]
8+
word = random.choice(words)
9+
scrambled = scramble_word(word)
10+
11+
print("Scrambled word:", scrambled)
12+
13+
14+
attempts = 3
15+
while attempts > 0:
16+
guess = input("Guess the word: ").lower()
17+
if guess == word:
18+
print("Correct! ????")
19+
break
20+
else:
21+
attempts -= 1
22+
print(f"Wrong! {attempts} attempts left.")
23+
24+
25+
if attempts == 0:
26+
print(f"Game over! The correct word was {word}.")

0 commit comments

Comments
 (0)