File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import random
2+
3+ #Create Welcome message Ask player A to enter a word
4+ hangman_display = ["" ,
5+ " _______________ " ,
6+ " | | " ,
7+ " | | " ,
8+ " | O " ,
9+ " | \ | / " ,
10+ " | \|/ " ,
11+ " | | " ,
12+ " | | " ,
13+ " | / \ " ,
14+ " | / \ " ,
15+ " | " ,
16+ " | " ,
17+ " | " ,
18+ "_______|_________________________ "
19+ ]
20+
21+ print ("\n " .join (hangman_display [0 : len (hangman_display )]))
22+ print ("\n " )
23+ print ("Welcome to Hangman Game!!!" )
24+
25+ secret_word_clue = {
26+ "Taylor Swift" , "Famous Female Pop Singer" ,
27+ "Java" , "Number one programming language" ,
28+ "Albert Einstein" , "A famous American Scientist" ,
29+ "Barack Obama" , "A well known American President" ,
30+ "The White House" , "A famous building in Washington DC"
31+ }
32+
33+ rand = random .randint (0 , len (secret_word_clue ) + 1 )
34+
35+
36+ #If player B guesses correct letter, fill in the letter at that position
37+
38+ #If player A guesses wrong letter, start building hangman
39+
40+ #If the hangman is complete, player A wins
41+
42+ #Player B wins, if word guessed correctly before the hangman formed
43+
You can’t perform that action at this time.
0 commit comments