0% found this document useful (0 votes)
11 views15 pages

Dice Rolling Simulator SHRINATH

Uploaded by

yuvraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views15 pages

Dice Rolling Simulator SHRINATH

Uploaded by

yuvraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Mini Project Report

“Guess Number”

Submitted by

Under the Guidance of

Prof. K.A.Margaje

Department of First Year Engineering

Rajgad Dnyanpeeth’s
SHRI CHHATRAPATI SHIVAJIRAJE COLLEGE OF
ENGINEERING
S. No. 237, Satara-Pune, NH-4, Dhangawadi, Tal: Bhor, Dist: Pune
Rajgad Dnyanpeeth’s
SHRI CHHATRAPATI SHIVAJIRAJE COLLEGE OF
ENGINEERING
S. No. 237, Satara-Pune, NH-4, Dhangawadi, Tal: Bhor, Dist: Pune

CERTIFICATE

This is to certify that the “Mini Project Report” submitted By Mr.Shingade Srinath
sharad “ Guess Number: work done by him and
2025 academic year, in partial fulfillment of the requirements for the award of the degree
of
Bachelor of Engineering in computer Engineering, at Rajgad Dnyaneepth’s Shri
Chhatrapati Shivajiraje College of Engineering, Dhangwadi, Pune.

Prof.K.A.Margaje Prof. J.G.Kale


Guide Head of Department

TABLE OF CONTENTS
Title
Sr No. Page No.

Introduction
1 05 -06

2 Model description and Design 07-09

Result
3 10-12

Conclusion
4 13

Reference
5 14

4|Page
ACKNOWLEDGEMENT

It gives us an immense pleasure to express our gratitude and thanks to all those who
helped in the timely completion of the seminar work.We have a great pleasure in expressing
our deep sense of gratitude and indebtedness to Prof.K.A.Margaje Guide for their invaluable
guidance, constant supervision and sustained encouragement throughout the tenure in this
dissertation work.We would like to express our thanks to, Prof.J.G.kale, Head of Department,
Department of Computer Engineering, Shree Chhatrapati Shivajiraje College of Engineering,
Pune for their constant support and encouragement.We would like to express our thanks to
Prof. Dr. S. B. Patil Principal, Shree Chhatrapati Shivajiraje College of Engineering, Pune for
permitting us to take up the project work.We are thankful of our parent and friends for their
kind help and support throughout the course.
INTRODUCTION

Guess Number Game


A fun and interactive game where a computer randomly selects a number,
and the user has to guess the number with feedback provided after each
guess.
Problem Statement:
The user will try to guess a number chosen by the program. After every
incorrect guess, the program will inform the user whether the guess was too
high or too low. The game continues until the user guesses the correct
number. The game will include error-checking to ensure the input is a valid
number.
Purpose and Scope of Model:
This model aims to simulate a number-guessing game. The purpose is to
create a simple and interactive game to practice basic programming
concepts like loops, conditions, and user input validation. It is intended for
casual users who want to enjoy a simple game while learning basic
programming.
Objective:
 Generate a random number.
 Allow the user to guess the number.
 Validate user input to ensure it is numeric.
 Provide feedback on whether the guess is too high, too low, or correct.
 Implement a loop to allow multiple guesses until the correct number is
guessed.

Software Requirements:
 Python 3.x or higher
 IDE or text editor (e.g., VS Code, PyCharm, Sublime Text)
 Operating System: Any (Windows, macOS, Linux)
Hardware Requirements:
 A computer or device capable of running Python code
 At least 2 GB of RAM (minimum requirement for Python-based
applications)
 Processor: Any modern CPU (Intel or AMD)
Model Description and Design
Step-by-Step Description of the Model - Algorithm
Generate Random Number:
The program will generate a random number between a specified range (e.g., 1 to 100).
User Input:
The program will prompt the user to guess the number.
The user will input their guess as a string.
Input Validation:
Check if the input is a valid number (integer).
If the input is invalid, display an error message and prompt the user again.
Comparison:
Compare the user's guess to the randomly generated number.
If the guess is too low, display "Too low!".
If the guess is too high, display "Too high!".
If the guess is correct, display "Congratulations! You've guessed the correct number!"
and end the game.
Repeat:
The process continues until the user guesses the correct number.
End Game:
Once the user guesses the correct number, the game ends.


Architecture of Model
 User Input Layer: The layer where the user interacts with the game
(inputting guesses).
 Processing Layer: Where the program validates the input, compares
the guess with the random number, and determines the feedback.
 Output Layer: Displays feedback to the user after each guess
(whether it's too low, too high, or correct).

Technique and Tools Used


 Programming Language: Python 3.x
 Input Validation: Python’s exception handling with try and except
blocks.
 Random Number Generation: Python's random.randint() function.
 Loops: while loop to continue prompting for guesses until the user
guesses correctly.
 Conditional Statements: if, elif, and else for comparing guesses.
Result
The game will run until the user guesses the correct number. The result will
display:
 "Too low!" if the guess is less than the target number.
 "Too high!" if the guess is greater than the target number.
 "Congratulations!" when the user guesses the correct number.

Code
Copy code
import random

# Function to check if the input is a valid number

def is_valid_number(input_value):

try:

# Try converting the input to an integer

num = int(input_value)

return True

except ValueError:

# If it cannot be converted to an integer, it's not a valid number

return False

# Function to compare the guessed number with the random number

def compare_numbers(user_guess, target_number):

if user_guess < target_number:

return "Too low!"

elif user_guess > target_number:

return "Too high!"

else:

return "Congratulations! You've guessed the correct number!"

# Main function to play the Guess Number game

def guess_number():
# Randomly generate a number between 1 and 100

target_number = random.randint(1, 100)

guessed_correctly = False

print("Welcome to the Guess the Number game!")

print("I have chosen a number between 1 and 100. Try to guess it!")

while not guessed_correctly:

user_input = input("Enter your guess: ")

# Check if the user input is valid

if is_valid_number(user_input):

user_guess = int(user_input)

feedback = compare_numbers(user_guess, target_number)

print(feedback)

# Check if the guess is correct

if user_guess == target_number:

guessed_correctly = True

else:

print("Invalid input. Please enter a valid number.")

# Call the main function to start the game


guess_number()

.
Flowchart
Below is the flowchart for the "Guess Number" game:
mathematica
Copy code
Start
|
Generate Random Number
|
Ask for User Input (Guess)
|
Is Input a Valid Number? ---- No ----> Display "Invalid
input. Try again."
|
Yes
|
Compare Guess with Random Number
|
Is Guess Too Low? ---- Yes ----> Display "Too low!"
|
Is Guess Too High? ---- Yes ----> Display "Too high!"
|
Guess Correct? ---- Yes ----> Display "Congratulations!" and
end the game
|
Repea

References
Python Documentation: https://docs.python.org/3/
Python's random module: https://docs.python.org/3/library/random.html
Stack Overflow discussions on handling input validation:
https://stackoverflow.com/

ag
R ajgad Dnyanpeeth’s
SHRI CHHATRAPATI SHIVAJIRAJE COLLEGE OF
ENGINEERING
S. No. 237, Satara-Pune, NH-4, Dhangawadi, Tal: Bhor, Dist:
Pune

CERTIFICATE

This is to certify that the “Mini Project Report” submitted By Mr.Shingate


Sarthak Vijay “ Guess Number: work done by him and
2025 academic year, in partial fulfillment of the requirements for the award
of the degree of
Bachelor of Engineering in computer Engineering, at Rajgad
Dnyaneepth’s Shri Chhatrapati Shivajiraje College of Engineering,
Dhangwadi, Pune.

11 | P e
Rajgad Dnyanpeeth’s
SHRI CHHATRAPATI SHIVAJIRAJE COLLEGE OF
ENGINEERING
S. No. 237, Satara-Pune, NH-4, Dhangawadi, Tal: Bhor, Dist: Pune

CERTIFICATE

This is to certify that the “Mini Project Report” submitted By Mr.Shinde Sujal Sunil
“ Guess Number: work done by him and
2025 academic year, in partial fulfillment of the requirements for the award of the
degree of
Bachelor of Engineering in computer Engineering, at Rajgad Dnyaneepth’s Shri
Chhatrapati Shivajiraje College of Engineering, Dhangwadi, Pune.

R ajgad Dnyanpeeth’s
SHRI CHHATRAPATI SHIVAJIRAJE COLLEGE OF
ENGINEERING

14 | P a g e
S. No. 237, Satara-Pune, NH-4, Dhangawadi, Tal: Bhor, Dist: Pune

CERTIFICATE

This is to certify that the “Mini Project Report” submitted By Mr.Shinde Yuvraj
Sadashiv “ Guess Number: work done by him and
2025 academic year, in partial fulfillment of the requirements for the award of the
degree of
Bachelor of Engineering in computer Engineering, at Rajgad Dnyaneepth’s Shri
Chhatrapati Shivajiraje College of Engineering, Dhangwadi, Pune.

Output
mathematica
Copy code
Welcome to the Guess the Number game!
I have chosen a number between 1 and 100. Try to guess it!
Enter your guess: 50
Too high!
Enter your guess: 30
14 | P a g e
Too low!
Enter your guess: 40
Too high!
Enter your guess: 35
Congratulations! You've guessed the correct number!

Conclusion
The "Guess Number" game effectively implements basic programming
, concepts such as loops, input validation, random number generation, and
condition-based comparisons. By following a simple design and
using .Python's built-in functions, the program allows users to play an
interactive .guessing game

14 | P a g e
14 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy