Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 15

CHAPTER 1

INTRODUCTION

1.1 OUTLINE OF THE PROJECT

In this project I am going to make a simple Hangman game using Python


programming language. We use modules like random,counter.The main objective of
the project is to create a program to gain knowledge about the Word Building .

1.2 LITERATURE REVIEW

Python is one of those rare languages which can claim to be both simple and
powerful. You will find yourself pleasantly surprised to see how easy it is to
concentrate on the solution to the problem rather than the syntax and structure of
the language you are programming in. When you write programs in Python, you
never need to bother about the low-level details such as managing the memory used
by your program,etc. Python is an example of a FLOSS (Free/Libre and Open
Source Software). In simple terms, you can freely distribute copies of this software,
read its source code, make changes to it, and use pieces of it in new free programs.

1.3 PROBLEM STATEMENT

Some times we make mistake to Spell a Word to overcome that mistake. I have made
a game named as Hangman based on python programming. Basically in this we have
to guess the words and fill in the given blanks.

1
1.4 OBJECTIVES

The main objectives of this project is selects a secret word from a list of secret words. The
random module will provide this ability, so line 1 in program imports it.

The modules used here are:

 Random
 Counter

2
CHAPTER 2

AIM AND SCOPE

2.1 AIM

The main aim of the project is to provide features like creating contacts, deleting
contacts, searching contacts and to modify the contacts, it also uses the database to
store the contacts details like address etc,. safely in the database. .

2.2 SCOPE

Python is a high level and multi-paradigm programming language designed by


Guido van Rossum, a Dutch programmer, having all the features as conventional
programming languages such as C, C++ and Java have.It is one of the fastest growing
languages and has undergone a successful span of more than 25 years as far as its
adoption is concerned. This success also reveals a promising future scope of python
programming language.In fact, it has been continuously serving as the best programming
language for application development, web development, game development, system
administration, scientific and numeric computing, GIS and Mapping etc.

2.3 SYSTEM REQUIREMENTS

2.3.1 HARDWARE REQUIREMENTS

The hardware requirements may serve as the basis for a contract for the
implementation of the system and should therefore be a complete and consistent
specification of the whole system. They are used by software engineers as the starting
point for the system design. It shows what the systems do and not how it should be
implemented.

• Hard disk : 120 GB

• Monitor : 15’ color with vgi card support

• Ram : Minimum 256 MB

3
• Processor : Pentium iv and above (or) equivalent

• Processor speed : Minimum 500 MHZ

2.3.2 SOFTWARE REQUIREMENTS

The software requirements are the specification of the system. It should include
both a definition and a specification of requirements. It is a set of what the system should
do rather than how it should do it. The software requirements provide

a basis for creating the software requirements specification. It is useful in estimating cost,
planning team activities, performing tasks and tracking the team’s and tracking the team’s
progress throughout the development activity.

• Operating system : Windows XP,10,8,8.1,7.

• Languages : Python 3.7

• IDE : Python IDLE 3.7

4
CHAPTER 3

SYSTEM IMPLEMENTATION

3.1 PYTHON IDE

An IDE (or Integrated Development Environment) is a program


dedicated to software development. As the name implies, IDEs integrate several
tools specifically designed for software development. These tools usually include
an editor tailored to handling code (for example, syntax highlighting and auto-
completion); build, execution, and debugging tools; and some form of source
control. Most IDEs support many different programming languages and contain
many more features, and therefore can be large, take time to download and
install, and require advanced knowledge to use properly. In contrast, a dedicated
code editor can be as simple as a text editor with syntax highlighting and code
formatting capabilities. Most good code editors can execute code and control a
debugger, and the very best interact with source control systems as well.
Compared to an IDE, a good dedicated code editor is usually smaller and
quicker, but often less feature rich.

3.1.1 ROLE OF PYTHON

It plays a major role in developing this project. Through python we have


developed this program. Execution become very easy in python. Pythonis widely
used on the server side. Python is rather widely scripting. It is widely used as a
embedded language.

3.2 IMPLEMENTATION

The origins of Hangman are obscure meaning not discovered, but it seems to
have arisen in Victorian times, ” says Tony Augarde, author of The Oxford Guide
to Word Games. The game is mentioned in Alice Bertha Gomme’s “Traditional
Games” in 1894 under the name “Birds, Beasts and Fishes.” The rules are
simple; a player writes down the first and last letters of a word and another player
guesses

5
the letters in between. In other sources, [where?] the game is called “Gallows”,
“The Game of Hangin”, or “Hanger”.

This is a simple Hangman game using Python programming language. Beginners


can use this as a small project to boost their programming skills and
understanding logic.

1. The Hangman program randomly selects a secret word from a list of


secret words. The random module will provide this ability, so line 1 in
program imports it.
2. The Game: Here, a random word (a fruit name) is picked up from our
collection and the player gets limited chances to win the game.
3. When a letter in that word is guessed correctly, that letter position in the
word is made visible. In this way, all letters of the word are to be guessed
before all the chances are over.
4. For convenience, we have given length of word + 2 chances. For
example, word to be guessed is mango, then user gets 5 + 2 = 7 chances,
as mango is a five letter word.
3.3 FEASABILITY STUDY

Sometimes a feasibility study is done as part of a systems


development lifecycle, in order to drive precision for the implementation of
technologies. Engineers might look at a five-point model called TELOS — this
includes the following components:

• Technical
• Economic
• Legal
• Operational
• Schedule

Under technical, engineers ask whether the correct technology exists to support
a project. Under economic, they look at costs and benefits. Under legal, they look
at any barriers to legal implementation, for instance, privacy issues or safety

6
CHAPTER 4

CONCLUSION

4.1 CONCLUSION

Hence the project, it contains all the required functions which include
adding, viewing, deleting and updating contact lists. While adding the contact of a
person, he/she has to provide first name, last name, gender, address and contact
details. The user can also update the contact list if he/she wants to. For this, the
user has to double-click on a record that he/she wishes to edit. The system
shows the contact details in a list view. And also the user easily delete any
contact details.This GUI based Contact Management system provides the
simplest management of contact details. In short, this projects mainly focus on
CRUD.
There’s an external database connection file used in this mini project to save
user’s data permanently.

7
REFERENCES

1. Guttag, John V. (12 August 2016). Introduction to Computation and


Programming Using Python: With Application to Understanding Data. MIT
Press. ISBN 978-0-262-52962-4
2. Peterson, Benjamin (3 March 2019). "Python 2.7.16 released". Python
Insider. The Python Core Developers. Retrieved 4 March 2019.
3. "PEP 483 -- The Theory of Type Hints". Python.org.
4. File extension .pyo was removed in Python 3.5. See PEP 0488
5. Holth, Moore (30 March 2014). "PEP 0441 -- Improving Python ZIP
Application Support". Retrieved 12 November 2015.
6. https://www.w3schools.com/python/

8
APPENDIX
LIST OF FIGURES

Fig 5.1: Source Code

Fig 5.2: Running Source Code

9
Fig 5.3: Output Screen

Fig 5.4: Five letters Words

10
Fig 5.5:Ten letters Words

Fig 5.6: Incorrect Word

11
SOURCE CODE:
# Python Program to illustrate
# Hangman Game
import random
from collections import Counter
someWords = '''apple banana mango strawberry
orange grape pineapple apricot lemon coconut
watermelon
cherry papaya berry peach lychee muskmelon'''
someWords = someWords.split(' ')
# randomly choose a secret word from our
"someWords" LIST.
word = random.choice(someWords)

if __name__ == '__main__':
print('Guess the word! HINT: word is a name of a
fruit')

for i in word:
# For printing the empty spaces for letters
of the word
print('_', end = ' ')
print()
playing = True
# list for storing the letters guessed by the player
letterGuessed = ''
chances = len(word) + 2
correct = 0
flag = 0
try:
while (chances != 0) and flag == 0: #flag is
updated when the word is correctly guessed
print()
chances -= 1
try:
guess = str(input('Enter a
letter to guess: '))
except:
print('Enter only a letter!')
continue

# Validation of the guess


if not guess.isalpha():
print('Enter only a LETTER')
continue
elif len(guess) > 1:
print('Enter only a SINGLE letter')
continue
elif guess in letterGuessed:

12
#continue

# If letter is guessed correctly


if guess in word:
k = word.count(guess) #k
stores the number of times the guessed letter occurs in
the word
for _ in range(k):
letterGuessed +=
guess # The guess letter is added as many times as it
occurs
# Print the word
for char in word:
if char in letterGuessed and (Counter(letterGuessed) !=
Counter(word)):
print(char, end = ' ')
correct += 1
# If user has guessed all the
letters
elif (Counter(letterGuessed)
== Counter(word)): # Once the correct word is guessed
fully,
#the game ends, even if chances remain
print("The word is: ", end=' ')
print(word)
flag = 1
print('Congratulations, You won!')
break # To break out of the for loop
break # To break out of the while loop
else:
print('_', end = ' ')
# If user has used all of his chances
if chances <= 0 and
(Counter(letterGuessed) != Counter(word)):
print()
print('You lost! Try again..')
print('The word was
{}'.format(word))

except KeyboardInterrupt:
print()
print('Bye! Try again.')
exit()

13
14

You might also like