Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

without user-defined functions Write a program (hangman.py) that plays the hangman game with a user Phase 1: The program will initialize a hangmanstr to a

without user-defined functions

image text in transcribed image text in transcribed

Write a program (hangman.py) that plays the hangman game with a user Phase 1: The program will initialize a hangmanstr to a sentence of your choice (e.g. "I love Python"), show to the user the secret form of the original sentence (see example below), where all non-whitespace and non-punctuation characters are replaced by underscores and prompt the user for a letter Phase 2: Look at the end of the description! You need to make sure that all steps for Phase 1 are working properly before you continue to Phase 2. Assuming that the hangman sentence is"I love python", the following will be presented to the user: The secret sentence is: Please enter a letter: - If the letter s in the hangmanstr, your program should output after every user guess the following information: 1) number of times the letter appears in the string, 2) the updated secretstr (where the proper underscorels) will be replaced by the letter the user successfully found) and 3) the list of letters already picked by the user so far For example, if user guessed letter "o" the following will occur: Found 2 occurrences of the letter o' in the sentence! The secret sentence is: Letters used thus far: c If the user guesses incorrectly, the program should output the next body-part from the bodyparts list (see below) that is added to the hangman. It should also print: 1) the current status of the secretstr (with the letters found so far) and 2) the list of letters already picked by the user For example, if the user guessed letter "z" the following will occur: Sorry. that letter is not in the sentence You now have a ace added to the hangman The secret sentence is: Letters used thus ar: o,z Note: If the user picks a letter already guessed before, the program should output the proper message as shown below: Please enter a letter: z You guessed that letter already

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions