Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language is Python # Hangman game! # Assume the answer is hangman A = ['h','a','n','g','m','a','n'] L = ['_','_','_','_','_','_','_'] play = True while play == True:

Language is Python

# Hangman game!

# Assume the answer is "hangman"

A = ['h','a','n','g','m','a','n']

L = ['_','_','_','_','_','_','_']

play = True

while play == True:

#Ask the user to guess a letter

letter = str(input("Guess a letter: "))

# Check to see if that letter is in the answer

i = 0

for currentletter in A:

# If the letter user guessed is found in the answer,

#and if so, end the loop

if A == L:

play = False

print ("GREAT JOB!")

Write code to make this program react to INCORRECT letters by printing BAD GUESS!.

In Hangman, the user only gets 6 incorrect guesses before they lose and the game is over. Write code to implement this.

Rather than hard-coding the answer as hangman, randomly select a word from a LIST of words to use as the answer.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

1.who the father of Ayurveda? 2. Who the father of taxonomy?

Answered: 1 week ago

Question

Commen Name with scientific name Tiger - Wolf- Lion- Cat- Dog-

Answered: 1 week ago

Question

5. Discuss the key roles for training professionals.

Answered: 1 week ago