Pyrhon project hanguman game PDF

Title Pyrhon project hanguman game
Author Mopuri Manjunath
Course PYTHON
Institution Lovely Professional University
Pages 11
File Size 524.7 KB
File Type PDF
Total Downloads 67
Total Views 134

Summary

the python project on hanguman game report...


Description

ABSTRACT This is a simple Hangman game using Python programming language. We can use this as a small project to boost their programming skills and understanding logic. 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. Hangman is a popular word game in which one player (the "chooser") chooses a secret word and another player (the "guesser") attempts to guess the

word one letter at a time. If a guessed letter appears in the word, all instances of it are revealed. If not, the guesser loses a chance. If the guesser figures out the secret word before he or she runs out of chances, he or she wins. If not, the player who chose the word win

s.

TABLE OF CONTENTS TOPIC

PAGE NO

1. INTRODUCTION 1.1 Python Programming Language

2

1.2 Applications of Python

4

2. SYSTEM REQUIREMENTS 2.1 Software Requirements

5

2.2 Hardware Requirements

5

3. IMPLEMENTATION AND RESULTS 3.1 Project Code

6

3.2. Results

10

CONCLUSION

12

REFERENCES

12

Hangman Game

ORGANIZATION OF THE REPORT The report is divided into various chapters and is organized as follows:

Chapter 1: Introduction This chapter includes brief introduction to Python Programming Language and its applications.

Chapter 2: System requirements This chapter includes details of hardware and software requirements necessary for the execution of the project.

Chapter 3: Implementation and Results This chapter includes the program code of the project and the results of successful runs of the code.

Conclusion This section includes the conclusion about the project.

References This section includes the bibliographical references used for the development of the project.

CHAPTER 1

INTRODUCTION

Hangman Game

1.1. Python Programming language Python is one of the many open source object oriented programming application software available in the market . Python is developed by Guido van Rossum. Guido van Rossum started implementing Python in 1989. Python is a very simple programming language so even if you are new to programming, you can learn python without facing any issues. Some of the many uses of Python are application development, implementation of automation testing process, allows multiple programming build, fully constructed programming library, can be used in all the major operating systems and platforms, database system accessibility, simple and readable code, easy to apply on complex software development processes, aids in test driven software application development approach, machine learning/ data analytics, helps pattern recognitions, supported in multiple tools, permitted by many of the provisioned frameworks, etc. Some features of Python are-

1. Readable: Python is a very readable language. 2. Easy to Learn: Learning python is easy as this is a expressive and high level programming language, which means it is easy to understand the language and thus easy to learn.

Hangman Game 3. Cross platform: Python is available and can run on various operating systems such as Mac, Windows, Linux, Unix etc. This makes it a cross platform and portable language. 4. Open Source: Python is a open source programming language. 5. Large standard library: Python comes with a large standard library that has some handy codes and functions which we can use while writing code in Python. 6. Free: Python is free to download and use. This means you can download it for free and use it in your application. See: Open Source Python License. Python is an example of a FLOSS (Free/Libre Open Source Software), which means you can freely distribute copies of this software, read its source code and modify it. 7. Supports exception handling: If you are new, you may wonder what is an exception? An exception is an event that can occur during program exception and can disrupt the normal flow of program. Python supports exception handling which means we can write less error prone code and can test various scenarios that can cause an exception later on. 8. Advanced features: Supports generators and list comprehensions. We will cover these features later. 9. Automatic memory management: Python supports automatic memory management which means the memory is cleared and freed automatically

1.2. Applications of Python programming language Python can be used to develop different applications like web applications, graphic user interface based applications, software development application, scientific and numeric applications, network programming, Games and 3D applications and other business applications. It makes an interactive interface and easy development of applications.You may be wondering what all are the applications of Python. There are so many applications of Python, here are some of the them.

Hangman Game

1. Web development – Web framework like Django and Flask are based on Python. They help you write server side code which helps you manage database, write backend programming logic, mapping urls etc. 2. Machine learning – There are many machine learning applications written in Python. Machine learning is a way to write a logic so that a machine can learn and solve a particular problem on its own. For example, products recommendation in websites like Amazon, Flipkart, eBay etc. is a machine learning algorithm that recognises user’s interest. Face recognition and Voice recognition in your phone is another example of machine learning. 3. Data Analysis – Data analysis and data visualisation in form of charts can also be developed using Python. 4. Scripting – Scripting is writing small programs to automate simple tasks such as sending automated response emails etc. Such type of applications can also be written in Python programming language. 5. Game development – You can develop games using Python. 6. You can develop Embedded applications in Python. 7. Desktop applications – You can develop desktop application in Python using library like TKinter or QT.

CHAPTER 2

SYSTEM REQUIREMENTS 2.1 Software Requirements PyCharm2019.1.1(CommunityEdition) Build#PC-191.6605.12,built on April 3, 2019 JRE:11.0.2+9-b159.34amd64

Hangman Game JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

2.2 Hardware Requirements Operating system: windows 10 Processor: intel core i5 Disk space:1Gb

CHAPTER 3

IMPLEMENTATION AND RESULTS 3.1 About Project 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.

import random def play_again(): answer = input('Would you like to play again? yes/no').lower() if answer == 'y' or answer == 'yes': play_game() else: pass def get_word(): words = ['cat', 'dog', 'python', 'monkey', 'snake'] return random.choice(words) def play_game(): alphabet = 'abcdefghijklmnopqrstuvwxyz' word = get_word() letters_guessed = [] tries = 10 guessed = False print('The word contains', len(word), 'letters.') print(len(word) * '*') while guessed == False and tries > 0: print('You have ' + str(tries) + ' tries') guess = input('Please enter one letter or the full word.').lower() # 1 - user inputs a letter if len(guess) == 1: if guess not in alphabet: print('You have not entered a letter.') elif guess in letters_guessed: print('You have already guessed that letter before.') elif guess not in word: print('Sorry, that letter is not part of the word :(') letters_guessed.append(guess) tries -= 1 elif guess in word: print('Well done, that letter exists in the word!') letters_guessed.append(guess) else: print('No idea why we get this message, should be investigated further!') # 2 - user inputs the full word elif len(guess) == len(word): if guess == word: print('Well done, you have guessed the word!') guessed = True else: print('Sorry, that was not the word we were looking for :(') tries -= 1 # 3 - user inputs letters where the total number of letters =/= total number of letters in the word. else: print('The length of your guess is not the same as the length

of the word we\'re looking for.') status = '' if guessed == False: for letter in word: if letter in letters_guessed: status += letter else: status += '*' print(status) if status == word: print('Well done, you have guessed the word!') guessed = True elif tries == 0: print('You have run out of guesses and you haven\'t guessed the word.') play_again()

CONCLUSION In the conclusion of this project, Hangman is a traditional game, typically played with words. It’s possible, however, to play Category Hangman rather than guessing words the player might guess names of cities, or athletes, or fictional characters, or Duke professors, or top forty song titles the list is endless. You’ll be writing a program to play a “guess a word letter-by-letter” version of hangman as shown above. You’ll also be doing some statistical analysis of the words used in the Hangman game.

REFERENCES Bibliography: [1] “Python for everybody”, Charles R.Severance [2] “Think Python”, Allen B.Downey [3]”Python programming”, Mark lutz

Websites: [1]https://www.youtube.com/watch?v=QXeEoD0pB3E&list=PLsyeobzWxl7poL9JTVyndKe 6 2ieoN-MZ3 [2]https://www.youtube.com/watch?v=NKVOjPHfiSA [3] https://www.youtube.com/watch?v=BDi3SD7E6no...


Similar Free PDFs