Python Programme Final
Python Programme Final
PROJECT ON “BLACKJACK”
SUBMITTED TO : SUBMITTED BY :
2 of 19
CONTENTS
Teacher’s Signature
3 of 19
CERTIFICATE
EXTERNAL
REGISTRATION NO : 1134
CLASS : 11 AN2
Blackjack is a card-based game played at casinos. The participants in this game do not
compete with each other but the dealer assigned by the casino. The rules are :The magic
number for Blackjack is 21. The values for all the cards dealt to a player are added and if
the sum exceeds 21, the player busts and loses instantly.
If a player gets an exact 21, the player wins against the dealer. Otherwise, in order to win,
the sum of the player’s cards must be more than the sum of the dealer’s cards.
The ace card has a definite value of 10, whereas the ace can be counted as 1 or 11 suitable
to the player’s chances of winning. The value of the rest of the cards is defined by their
number.
The programming of the Blackjack game becomes simple as soon as the rules are
understood. Creating a terminal-based game from scratch requires three main
components: The Game Design, The Game Logic, and Management of Player Interaction.
7 of 19
OBJECTIVE
The Game Logic, and Management of Player Interaction. The entire game logic revolves around the
dealing of cards and player’s choices for either hitting or standing. As soon as we handle the
above two things Creating a terminal-based game from scratch requires three main components: The
Game Design,,we are done for the day. The picture included shows the game being
played. I used python to code this project.Python being a user friendly platform it
helps beginners coders like me to understanding coding in a easier manner.It helped
me to find the syntax in codes faster. I also learned how important it was to give
proper names to variables and functions.
8 of 19
SCOPE
9 of 19
REQUIREMENTS
HARDWARE AND SOFTWARE REQUIREMENTS:
10 of 19
DESCRIPTION
11 of 19
FUTURE SCOPE:
12 of 19
DRAWBACKS
• It encourages gambling
13 of 19
SOURCE CODE :
import random
import time
def play_loop():
global play_game
play_game = input("Do You want to play again? y = yes, n = no \n") while
play_game not in ["y", "n","Y","N"]:
play_game = input("Do You want to play again? y = yes, n = no \n")
if play_game == "y":
main()
14 of 19
elif play_game == "n":
15 of 19
print("Thanks For Playing! We expect you back again!")
exit()
else:
count += 1
if count == 1:
time.sleep(1)
print(" \n"
" | \n"
" | \n"
" | \n"
" | \n"
" | \n"
" | \n"
" | \n")
print("Wrong guess. " + str(limit - count) + " guesses remaining\n")
elif count == 2:
16 of 19
time.sleep(1)
print(" \n"
" | | \n"
" | |\n"
" | \n"
" | \n"
" | \n"
" | \n"
" | \n")
print("Wrong guess. " + str(limit - count) + " guesses remaining\n")
elif count == 3:
time.sleep(1)
print(" \n"
" | | \n"
" | |\n"
" | | \n"
" | \n"
" | \n"
" | \n"
" | \n")
print("Wrong guess. " + str(limit - count) + " guesses remaining\n")
elif count == 4:
time.sleep(1)
print(" \n"
" | | \n"
" | |\n"
" | | \n"
" | O \n"
" | \n"
" | \n"
" | \n")
print("Wrong guess. " + str(limit - count) + " last guess remaining\n")
elif count == 5:
time.sleep(1)
print(" \n"
" | | \n"
" | |\n"
" | | \n"
" | O \n"
" | /|\ \n"
" | / \ \n"
" | \n")
17 of 19
print("Wrong guess. You are hanged!!!\n")
print("The word was:",already_guessed,word)
play_loop()
main()
hangman()
18 of 19
OUTPUT:
19 of 19
20 of 19
CONCLUSION :
21 of 19
BIBLIOGRAPHY
• Sumita Arora
• www.wikipedia.com
• www.python.com
• jurnal.untan.ac.id
• pcgamebenchmark.com
• www.programiz.com
22 of 19