0% found this document useful (0 votes)
10 views

Python Report (1)

The document outlines a project on the 'Hangman game' developed by students of the School of Engineering and Technology as part of their B.Tech. curriculum in Computer Science and Engineering. It includes an abstract describing the game's implementation in Python, a detailed explanation of Python and Tkinter programming, and mentions the use of Visual Studio Code for development. The report concludes with insights on enhancing programming skills through game development.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Python Report (1)

The document outlines a project on the 'Hangman game' developed by students of the School of Engineering and Technology as part of their B.Tech. curriculum in Computer Science and Engineering. It includes an abstract describing the game's implementation in Python, a detailed explanation of Python and Tkinter programming, and mentions the use of Visual Studio Code for development. The report concludes with insights on enhancing programming skills through game development.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

SCHOOL OF ENGINEERING AND TECHNOLOGY

Project Work
On

“Hangman game”

For the requirement of 1th Semester (4CSPL1011 – Problem Solving Using Python) B.Tech. in

Computer Science and Engineering - AIML

Submitted By

Name USN
ABHISHEK A (24BBTCA006)
ALWIN C S (24BBTCA013)
C GUNASHEKAR (24BBTCA030)
ANANYA L GOWDA ROLL NO-18
BN BHARATH TEJA ROLL NO-27

Submitted to

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING - AIML

CMR University

Off Hennur - Bagalur Main Road, Near Kempegowda International Airport, Chagalahatti, Bengaluru,
Karnataka-562149 Academic Year - 2024-25

1
SCHOOL OF ENGINEERING AND TECHNOLOGY
Chagalahatti, Bengaluru, Karnataka-562149

Department of Computer Science and Engineering - AIML

CERTIFICATE

Certified that the Project Work entitled “Hangman game” carried out by (24BBTCA006),
(24BBTCA013),(24BBTCA030),ROLL NO-18, and ROLL NO-27
Bonafide students of SCHOOL OF ENGINEERING AND
TECHNOLGY, in partial fulfillment for the award of BACHELOR OF TECHNOLOGY in
1th Semester Computer Science and Engineering of CMR UNIVERSITY, Bengaluru during
the year 2025. It is certified that all corrections/suggestions indicated for the Internal
Assessment have been incorporated in the report. The project has been approved as it satisfies
the academic requirements in respect of project work prescribed for the said degree.

Course in charge H.O. D

2
Abstract:

The purpose of this project is to create a simple Python program that implements the classic Hangman game. Hangman is a
word-guessing game where players attempt to identify a hidden word by guessing letters within a limited number of attempts.
This report describes the program's design, functionality, and implementation, providing an engaging and interactive
experience for users.

3
SR . NO TOPIC PAGE . NO

1 Python 5

2 Tkinter Programming 7

3 Visual studio code 10

4 Source Code 11

5 Output 13

6 Conclusion 14

4
1. PYTHON

Python is a high-level, interpreted, interactive and object-oriented scripting language.


Python is designed to be highly readable. It uses English keywords frequently where as
other languages use punctuation, and it has fewer syntactical constructions than other
languages.
• Python is Interpreted − Python is processed at runtime by the interpreter. You do
not need to compile your program before executing it. This is similar to PERL and
PHP. Python is Interactive − You can actually sit at a Python prompt and interact
with the interpreter directly to write your programs.
• Python is Object-Oriented − Python supports Object-Oriented style or technique
of programming that encapsulates code within objects.
• Python is a Beginner's Language − Python is a great language for the
beginnerlevel programmers and supports the development of a wide range of
applications from simple text processing to WWW browsers to games.

History of Python

Python was developed by Guido van Rossum in the late eighties and early nineties at the
National Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++,
Algol68, SmallTalk, and Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).
Python is now maintained by a core development team at the institute, although Guido
van Rossum still holds a vital role in directing its progress.

Python Features

Python's features include −


• Easy-to-learn − Python has few keywords, simple structure, and a clearly defined
syntax. This allows the student to pick up the language quickly.
• Easy-to-read − Python code is more clearly defined and visible to the eyes.
• Easy-to-maintain − Python's source code is fairly easy-to- maintain.
• A broad standard library − Python's bulk of the library is very portable and
crossplatform compatible on UNIX, Windows, and Macintosh.
• Interactive Mode − Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.
• Portable − Python can run on a wide variety of hardware platforms and has the
same interface on all platforms.
• Extendable − You can add low-level modules to the Python interpreter. These
modules enable programmers to add to or customize their tools to be more efficient.

5
• Databases − Python provides interfaces to all major commercial databases.
• GUI Programming − Python supports GUI applications that can be created and
ported to many system calls, libraries and windows systems, such as Windows
MFC, Macintosh, and the X Window system of Unix.
• Scalable − Python provides a better structure and support for large programs than
shell scripting.
Apart from the above-mentioned features, Python has a big list of good features, few are
listed below −
• It supports functional and structured programming methods as well as OOP.
• It can be used as a scripting language or can be compiled to byte- code for building
large applications.
• It provides very high-level dynamic data types and supports dynamic type
checking.
• It supports automatic garbage collection.
• It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

6
2. Tkinter Programming
Tkinter is the standard GUI library for Python. Python when combined with Tkinter
provides a fast and easy way to create GUI applications. Tkinter provides a powerful
object-oriented interface to the Tk GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform
the following steps −
• Import the Tkinter module.
• Create the GUI application main window.
• Add one or more of the above-mentioned widgets to the GUI application. •

Enter the main event loop to take action against each event triggered by the user.

Example

#!/usr/bin/python3
import tkinter as tk

top = tk.Tk()
# Code to add widgets will go here...
top.mainloop()

This would create a following window −

Tkinter Widgets

Tkinter provides various controls, such as buttons, labels and text boxes used in a GUI
application. These controls are commonly called widgets.
There are currently 15 types of widgets in Tkinter. We present these widgets as well as a brief
description in the following table –

7
Sr.No. Operator & Description

1
Button

The Button widget is used to display buttons in your application.

2
Canvas
The Canvas widget is used to draw shapes, such as lines, ovals, polygons and rectangles, in
your application.

3
Checkbutton
The Checkbutton widget is used to display a number of options as checkboxes. The user can
select multiple options at a time.

4
Entry

The Entry widget is used to display a single-line text field for accepting values from a user.

5
Frame

The Frame widget is used as a container widget to organize other widgets.

6
Label
The Label widget is used to provide a single-line caption for other widgets. It can also contain
images.

7
Listbox

The Listbox widget is used to provide a list of options to a user.

8
Menubutton

The Menubutton widget is used to display menus in your application.

9
Menu
The Menu widget is used to provide various commands to a user. These commands are
contained inside Menubutton.

10
Message

The Message widget is used to display multiline text fields for accepting values from a user.
8
11
Radiobutton
The Radiobutton widget is used to display a number of options as radio buttons. The user can
select only one option at a time.

12
Scale

The Scale widget is used to provide a slider widget.

13 Scrollbar

The Scrollbar widget is used to add scrolling capability to various widgets, such as list boxes.

14
Text

The Text widget is used to display text in multiple lines.

15
Toplevel

The Toplevel widget is used to provide a separate window container.

16
Spinbox
The Spinbox widget is a variant of the standard Tkinter Entry widget, which can be used to select
from a fixed number of values.

17
PanedWindow
A PanedWindow is a container widget that may contain any number of panes, arranged
horizontally or vertically.

18
LabelFrame
A labelframe is a simple container widget. Its primary purpose is to act as a spacer or container
for complex window layouts.

19
tkMessageBox

This module is used to display message boxes in your applications.

9
3. VISUAL STUDIO CODE

Visual Studio Code is a free source code editor, made by Microsoft for Windows,
Linux and macOS. Features include support for debugging, syntax highlighting,
intelligent code completion, snippets, code refactoring, and embedded Git. Users can
change the theme, keyboard shortcuts, preferences, and install extensions that add
additional functionality. The python extension in Visual Studio Code makes it an
excellent video editor.

Fig1: Visual Studio Code Platform

10
4. PYTHON PROGRAM TO IMPLEMENT ROCK PAPER SCISSOR GAME

Python is a multipurpose language and one can do anything with it. Python can also be used for game
development. Let’s create a simple command-line Rock-Paper-Scissor game without using any external
game libraries like PyGame. In this game, the user gets the first chance to pick the option between Rock,
paper, and scissors. After the computer select from the remaining two choices(randomly), the winner is
decided as per the rules.

Winning Rules as follows:


Rock vs paper-> paper wins Rock vs scissor-> Rock wins paper vs scissor-
> scissor wins.

In this game, randint() inbuilt function is used for generating random integer values within the given range.

SOURCE CODE:

11
12
5. OUTPUT

13
6. CONCLUSION

Building a Rock, Paper, Scissors game in Python is a great way to enhance your programming skills while
also having fun. By following the steps outlined in this Python rock, paper, scissors game, you can create
your own game and customize it to your liking. Along the way, you will learn about basic programming
concepts such as functions, loops, and conditional statements. With some creativity and practice, you can
build more complex games using Python. Remember to keep coding and experimenting with new proj ects
to sharpen your skills. Happy coding!

14

You might also like