You will write a script that will allow a user to play a guessing name. The script must allow a user to enter a number 1-10. Give the user 5 tries to guess the correct answer. See below for specific...

1 answer below »

You will write a script that will allow a user to play a guessing name. The script must allow a user to enter a number 1-10. Give the user 5 tries to guess the correct answer. See below for specific requirements: Using the file included, answer questions 1-10.


































Objectives
1-3. Complete header comments.
4. Create a variable named numbers. It needs to generate a number between 1 to 10.
5. Create a variable named player_name. It needs to prompt the user to enter his/her name.

6. Create a variable named number_of_guesses and assign 0 to it.

7. Print a string that includes the player_name variable. It should say: player_name, I am guessing a number between 1 and 10!

8. Create a WHIlE Loop. Give the user 5 attempts to guess the number. If the number is too low print "Your guess is too low". If the number is too high print "Your guess is too high". Create a break if the user answers it correctly.


9. Verifying if the user has guessed the number or not. If they did, then print a message for them along with the number of tries. If the player couldn't guess the number at the end then print the number along with a message.


Activities 1 - 2 must run correctly to receive full credit.



# 1. Complete header comments # 2. # 3. # 4. Create a variable named numbers. It needs to generate a number between 1 to 10. # Put the answer on the next line. # 5. Create a variable named player_name. It needs to prompt the user to enter his/her name. # Put the answer on the next line. # 6. Create a variable named number_of_guesses and assign 0 to it. # Put the answer on the next line. # 7. Print a string which includes the player_name variable. It should say: player_name, I am guessing a number between 1 and 10! # Put the answer on the next line. # 8. Create a WHIlE Loop. Give the user 5 attempts to guess the number. If the number is too low print Your guess is too low. If the number is too high print Your guess is too high. Create a break if the user answers it correctly. # 9. if/else Statements - Verifying if the user has guessed the number or not.. If they did...then print a message for them along with the number of tries. If the player couldnt guess the number at the end...print the number along with a message.
Answered 7 days AfterOct 11, 2021

Answer To: You will write a script that will allow a user to play a guessing name. The script must allow a user...

Sathishkumar answered on Oct 18 2021
119 Votes
# 1. Complete header comments
# 2.
# 3.
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 18 08:
11:20 2021
@author: Your_Name
"""
import random
# 4. Create a variable named numbers. It needs to generate a number between 1 to 10.
# Put the answer on the next line.
numbers =random.randint(1,10)
print (numbers)
# 5. Create a variable named player_name. It needs to prompt the user to enter his/her name.
# Put the answer on the next line.
player_name = input("Enter your Name: ")
# 6. Create a variable named number_of_guesses and assign 0 to it.
#...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here