(Hangman Game) Write a
Guess the word: XXXXXX
Each X represents a letter. The user tries to guess the letters in the word. The appropriate response yes or no should be displayed after each guess. After each incorrect guess, display the diagram with another body part filled. After seven incorrect guesses, the user should be hanged. The display should look as follows:
0
/|\
I
/ \
After each guess, display all user guesses. If the user guesses the word correctly, display Congratulations!!! You guessed my word. Play again? yes/no
Want to see the full answer?
Check out a sample textbook solutionChapter 21 Solutions
C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
- Write the code completely.arrow_forwardAnswer the given question with a proper explanation and step-by-step solution. 1- Write code that does the following: opens an output file with the filename number_list.txt, uses a loop to write the numbers 1 through 100 to the file, then closes the file.arrow_forwardWhat is the output of the following code segment?arrow_forward
- If you're writing output to a binary file, what classes do you use to do this? What classes do you use to read data from a binary file and how do you do it?arrow_forwardWrite a few statements that open a file called "words" and writes the last word in the file to a file called "lastword".arrow_forwardDo you know what happens when you call the out function on your own to open a file when it doesn't exist?arrow_forward
- - Write a for loop with index i that iterates over all consecutive integers from 4 to 10 and prints the current loop index to screen for each value of i. As always, be careful with indentation and use proper python syntax. - Same question as above, but add a logical (if) statement inside the loop that prints both the loop index and the message "is greater than 6" or "is less than or equal to 6" for the appropriate indices. Hint, use the syntax print(i, "string") to print both the loop index and the string at the same time.arrow_forward- Write a for loop with index i that iterates over all consecutive integers from 4 to 10 and prints the current loop index to screen for each value of i. As always, be careful with indentation and use proper python syntax. - Same question as above, but add a logical (if) statement inside the loop that prints both the loop index and the message "is greater than 6" or "is less than or equal to 6" for the appropriate indices. Hint, use the syntax print(i, "string") to print both the loop index and the string at the same time. - Write the same for loop as in the first question above, but modify it to only print the loop index when i is not equal to 8.arrow_forwardPlease Write a program that reads data from a file containing integers that ends with -999. Output the numbers that are divisible by 7 Output the numbers that are divisible by 11 Output the numbers that are not divisible by 7 or 11. Okarrow_forward
- The function print_last_line in python takes one parameter, fname, the name of a text file. The function should open the file for reading, read the lines of the file until it reaches the end, print out the last line in the file, report the number of lines contained in the file, and close the file. Hint: Use a for loop to iterate over the lines and accumulate the count. For example: Test Result print_last_line("wordlist1.txt") maudlin The file has 5 lines.arrow_forwardMy code doesnt pass this test case How would I get my code to pass this test case? Sample Input 3 this file, tests TEST a, b c erroneous cases TEST, a, b there should, only, be TEST, a b six lines, in, the, output TEST a b and it, should TEST a , b, c include this, one TEST a, b,, c Sample Output 3 this file tests erroneous cases there should only be six lines in the output and it should include this one Explanation 3 All of the lines beginning with TEST have some sort of syntax error, so they should be omitted from the output. The other lines have no errors, so they should be tokenized and output. The errors are as follows: TEST a, b c: the comma between b and c is missing TEST, a, b: there is an extra comma after TEST TEST, a b: the comma between a and b is missing, and there is an extra comma after TEST TEST a b: the comma between a and b is missing TEST a , b, c: there is a space before the comma between a and b def tokenize(line): token_list = [] for token in line.split():…arrow_forwardwrite you c++ code to read a file contains simple +/- maths equations and change it to plus and minus input file example: A+B, 10+20,30-50,8=100output file example A plus B , 10 Plus 20 , 30 minus 50 , 8 plus 100arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education