Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangman game #129

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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
Prev Previous commit
Next Next commit
Some code simplification
  • Loading branch information
JFincher42 committed Aug 19, 2020
commit 0bb6f6520bfa13c5a23ff9609479383896ebbe14
7 changes: 2 additions & 5 deletions hangman/hangman/hangman_basic.py
Original file line number Diff line number Diff line change
@@ -208,13 +208,10 @@ def validate_input(player_guess: str, letters_guessed: set) -> bool:
# How many guesses have they taken?
guesses_taken = 0

# What is the word the user is trying to guess?
current_word = ""

# Begin the game
print("Welcome to Hangman!")

# Select the word and make a display version
# Select the word to be guessed and make a display version
current_word = select_word()
displayed_word = build_displayed_word(current_word, letters_guessed)

@@ -234,7 +231,7 @@ def validate_input(player_guess: str, letters_guessed: set) -> bool:
player_guess = str.lower(input("Guess a letter: "))

# Is this letter in the current word?
if player_guess in set(current_word):
if player_guess in current_word:
print("Great guess!")
else:
print("Sorry, it's not there.")