0% found this document useful (0 votes)
0 views10 pages

English Social Media

The document outlines a project on creating a number guessing game using Python, detailing key components such as generating a random number, getting user input, and checking guesses. It emphasizes the use of programming concepts like loops, conditionals, and functions to enhance the game's interactivity. The conclusion encourages customization of the game for a unique experience.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views10 pages

English Social Media

The document outlines a project on creating a number guessing game using Python, detailing key components such as generating a random number, getting user input, and checking guesses. It emphasizes the use of programming concepts like loops, conditionals, and functions to enhance the game's interactivity. The conclusion encourages customization of the game for a unique experience.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

TOPIC- The Perfect Guess using


Python

Name: CHANDRA PRAKASH (21SCSE1011469)


ASHISH KUMAR SINHA (21SCSE1011493)
RAJ ARYAN (21SCSE1011492)
ASHUTOSH RAI (21SCSE1011691)
Section: 21

Program Name:B.Tech(CSE)
School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Agenda

• Generating a Random Number


• Getting User Input
• Er Diagram
• Checking User Input
• Allowing Multiple Attempts
• Conclusion

Program Name: B.Tech (CSE)


School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Introduction

The number guessing game is a classic game where the computer generates a
random number and the player has to guess it within a certain number of attempts.

In Python, we can create this game using simple programming concepts such as
loops, conditionals, and functions.

Program Name: B.Tech (CSE)


School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Generating a Random Number

To create the number guessing game, we first need to generate a


random number. In Python, we can use the 'random' module to
do this.
We can use the 'randint' function to generate a random integer
within a specified range. For example, if we want to generate a
random number between 1 and 100, we can use the following
code: 'random.randint(1, 100)'

Program Name: B.Tech (CSE)


School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Getting User Input

Once we have generated a random number, we need to get user input to allow them to guess the
number.

We can use the 'input' function to get user input. We can also use a loop to allow the user to keep
guessing until they either guess the correct number or run out of attempts .

Program Name: B.Tech (CSE)


School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Program Name: B.Tech (CSE)


School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Checking User Input

After getting the user input, we need to check if it is correct or not.

We can use conditional statements such as 'if', 'elif', and 'else' to check if
the user's guess is equal to the random number. We can also provide
feedback to the user based on their guess.

Program Name: B.Tech (CSE)


School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Allowing Multiple Attempts

To make the game more engaging, we can allow the user to have multiple
attempts to guess the number.

We can use a loop to keep track of the number of attempts and give the
user feedback on how many attempts they have left. We can also end the
game if the user runs out of attempts without guessing the correct number.

Program Name: B.Tech (CSE)


School of Computing Science and Engineering

Course Code : E2UC401C Name: Progamming in Python

Conclusion

In conclusion, creating a number guessing game in Python is a fun and


easy way to learn programming concepts such as loops, conditionals, and
functions.

By following the steps outlined in this presentation, you can create your
own version of the game and even customize it to make it more
challenging or unique.

Program Name: B.Tech (CSE)

You might also like