0% found this document useful (1 vote)
5K views

Number Guessing Game Using Python Project Report

This document describes a number guessing game project created by four B.Tech students using Python. The project involved building a game where a computer randomly selects a number between 1-100 and the user tries to guess it in the fewest attempts. The algorithm uses random number generation, user input, and conditional statements to provide feedback if guesses are too high or low and indicate when the user guesses correctly. The project fulfills requirements for the students' IT Engineering degree and was carried out under the guidance of their professor.

Uploaded by

Avanish Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
5K views

Number Guessing Game Using Python Project Report

This document describes a number guessing game project created by four B.Tech students using Python. The project involved building a game where a computer randomly selects a number between 1-100 and the user tries to guess it in the fewest attempts. The algorithm uses random number generation, user input, and conditional statements to provide feedback if guesses are too high or low and indicate when the user guesses correctly. The project fulfills requirements for the students' IT Engineering degree and was carried out under the guidance of their professor.

Uploaded by

Avanish Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Number Guessing Game

using Python

B.Tech. Project report submitted in partial fulfilment

of the requirements of the degree of

IT Engineering
by

Avanish Tiwari PRN No. 2043110232

Kaustubh Phadke PRN No. 2043110233

Mehak Dhall PRN No. 2043110223

Harshada Dixit PRN No. 2143110243

Under the guidance of


Ms. Diksha Balerao
(Designation)

BHARATI VIDYAPEETH DEEMED TO BE UNIVERSITY


DEPARTMENT OF ENGINEERING AND TECHNOLOGY,
NAVI MUMBAI CAMPUS
2022–2023

CERTIFICATE

This is to certify that the B.Tech. Project entitled “Number Guessing Game using

Python” is a bonafide work of

“Avanish Tiwari” (2043110232), “Kaustubh Phadke” (2043110233),

“Mehak Dhall” (2043110223), and “Harshada Dixit” (2143110243) submitted


to Bharati Vidyapeeth Deemed to be University, Department of Engineering and Technology,

Navi Mumbai in partial fulfilment of the requirement for the award of the degree of “IT

Engineering” during the academic year 2022–2023.

Ms. Diksha Bhalerao


Guide

Dr. Mohan Awasthy

Head of Department Principal


B.Tech. Project Report Approval

This Project synopsis entitled Number Guessing Game using Python by


Avanish Tiwari, Kaustubh Phadke ,Mehak Dhall, Harshada Dixit is
approved for the degree of IT Engineering from Bharati Vidyapeeth
Deemeed to be University, Pune.

Examiners

1.---------------------------------------------

2.---------------------------------------------

Date:

Place:
Declaration
We declare that this written submission represents our ideas in our own words and where
others’ ideas or words have been included, we have adequately cited and referenced the original
sources. We also declare that we have adhered to all principles of academic honesty and integrity
and have not misrepresented or fabricated or falsified any idea/data/fact/source in our submission.
We understand that any violation of the above will be cause for disciplinary action by the Institute
and can also evoke penal action from the sources which have thus not been properly cited or from
whom proper permission has not been taken when needed.

---------------------------------------
Signature
Avanish Tiwari (2043110232)

---------------------------------------
Signature
Kaustubh Phadke (2043110233)

---------------------------------------
Signature
Mehak Dhall (2043110223)

---------------------------------------
Signature
Harshada Dixit (2143110243)

Date:
INDEX

1) Abstract
2) Introduction
3) Scope & Purpose
4) Method of Implementation
5) Conclusion
6) Reference
Abstract

Team Member:
1.Avanish Tiwari (2043110229)
2.Kaustubh Phadke (2043110231)
3.Mehak Dhall (2043110223)
4. Harshada Dixit (2143110243)

Brief information regarding project:

Python program to create a Number Guessing Game using Python


Programming concepts
This is a project report on “Number Guessing Game using Python”’ it is a
python program based game which is create for the purpose of entertainment.
This python program contain basics of python such as user input, while
condition, if- else condition.
Basic logic behind the game is that system will ask about the numbers and the
according to the number is entered by the user it will gives output such as ‘Too
low’ or ‘Too High’ and when the number is get correct it will show output as ‘
‘you guesed it right!’. And this number will be random and will get depends on
the random fuction which we will used in python program.

Language:
Python
Ide:
VS Code

Introduction:-
Number Guessing Game using Python is the application is mostly used
guessing game.
This is going to be a simple guessing game where the computer will
generate a random number between 1 to 100, and the user has to guess it
in 4 attempts
Bases on the user’s guess computer will give various hints if the number
is high or low. When the user guess watches the number computer will
print the answer along with the number of attempts

Purpose:-
The number guessing game is a popular game among programmers. In
the number guessing game, the program selects a random number
between two numbers, and the user guesses the correct number. If you
want to learn how to create a guessing game using Python, this Project is
for you. In this Project, I will take you through a tutorial on creating a
number guessing game using the Python programming language.

Task:-
• Build a Number guessing game, in which the user selects a range.
• Let’s say User selected a range, i.e., from A to B, where A and B belong
to Integer.
• Some random integer will be selected by the system and the user has to
guess that integer in the minimum number of guesses

Method Of Implementation:-

•  If the User inputs range, let’s say from 1 to 100. And compiler randomly
selected 42 as the integer. And now the guessing game started, so the user
entered 50 as his/her first guess. The compiler shows "Too high!"

• That’s mean the random number (i.e., 42) doesn’t fall in the range from
50 to 100. That’s the importance of guessing half of the range. And again,
the user guesses half of 50 (Could you tell me why?). So the half of 50 is
25. The user enters 25 as his/her second guess. This time compiler will
show, "Too low"

• That’s mean the integers less than 25 (from 1 to 25) are useless to be
guessed. Now the range for user guessing is shorter, i.e., from 25 to 50.
Intelligently! The user guessed half of this range, so that, user guessed 37
as his/her third guess.  This time again the compiler shows the output,
"Too low"
• For the user, the guessing range is getting smaller by each guess. Now,
the guessing range for user is from 37 to 50, for which the user guessed
43 as his/her fourth guess. This time the compiler will show an output
"Too high!"

• So, the new guessing range for users will be from 37 to 43, again for
which the user guessed the half of this range, that is, 40 as his/her fifth
guess.  This time the compiler shows the output, "Too low“

• Leaving the guess even smaller such that from 41 to 43. And now the
user guessed 41 as his/her sixth guess. Which is wrong and shows
output . And finally, the User Guessed the right number which is 42 as
his/her seventh guess.

Algorithm:-
Steps:_
• User inputs the lower bound and upper bound of the range.
• The compiler generates a random integer between the range and store it in
a variable for future references.
• For repetitive guessing, a while loop will be initialized.
• If the user guessed a number which is greater than a randomly selected
number, the user gets an output "Too high!"
• Else If the user guessed a number which is smaller than a randomly
selected number, the user gets an output "Too low"
• And if the user guessed in a minimum number of guesses, the user gets a
"you guessed it right!!" Output.
Code:-
import random
n = random.randrange(1,100)
guess = int(input("Enter any number: "))
while n!= guess:
if guess < n:
print("Too low")
guess = int(input("Enter number again: "))
elif guess > n:
print("Too high!")
guess = int(input("Enter number again: "))
else:
break
print("you guessed it right!!")
Conclusion:-
So this is how you can write a program to create a guessing game using Python.
It is a popular game among programmers. In this game, the program selects a
random number between two numbers, and the user guesses the correct number.
I hope you liked this presentation on how to create a guessing game using
Python. Feel free to ask valuable questions.
Reference :-

https://thecleverprogrammer.com/2022/06/29/number-guessing-
game-using-python/

You might also like