Skip to content

natnew/Python-Projects-Word-Guessing-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 

Repository files navigation

Python Projects: Word Guessing Game ๐Ÿ

This repo contains python code that takes your character and matches it against the charaters in a random word. The aim is to guess the random word.
Run the code.

Python

import random

name = input("What is your name? ")

print("Good Luck!", name)

words = ["blueberry", "grape", "apple", "mango", "watermellon"]

word = random.choice(words)

print("Guess the characters")

guesses = ''

turns = 12

while turns > 0:
    failed = 0

    for char in guesses:
        print(char)

    else:
        print("_")

        failed += 1

    if failed == 0:
        print("You win!")

        print("This word is ", word)
        break

    guess = input("guess a character: ")

    guesses += guess

    if guess not in word:
        turns -= 1
        print("Wrong")

        print("You have", + turns, "more guesses")

        if turns == 0:
            print("You Loose")

Output

What is you name?
Good Luck! name
Guess the character...

About

Python Projects Word Guessing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages