Skip to content

Commit ba2df8d

Browse files
Merge pull request steam-bell-92#1435 from vipul674/main
🐛 fix: validate empty input in Word-Building game to prevent IndexError
2 parents 056a8c3 + fd965dc commit ba2df8d

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

games/Word-Building/word_building.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ def Main():
3535
# Game loop
3636
while True:
3737
# User input and validation
38-
user_word = input("Your word: ")
38+
user_word = input("Your word: ").strip()
39+
if not user_word:
40+
print("\nPlease enter a valid word!")
41+
continue
3942
if (bot_word is not None) and (user_word[0].lower() != bot_word[-1].lower()):
4043
print("\nInvalid word! Your word must start with the last letter of bot's word.")
4144
win = False

utilities/Progress-Tracker/Progress-Tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from datetime import datetime
99

1010
# ── Config ────────────────────────────────────────────────────────────────────
11-
DATA_FILE = "completed_projects.json"
11+
DATA_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "completed_projects.json")
1212

1313
# Load Project Registry from projects_registry.json
1414
REGISTRY_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "projects_registry.json"))

0 commit comments

Comments
 (0)