So now comes the most interesting part.....
Every game is incomplete without some graphics ,so we introduced a function hangman_graphic that is called whenever the attempts remaining are decremented and displays stages of hangman and when the attempts are over then a complete graphic of hangman is displayed!
Following is the function code:-
Every game is incomplete without some graphics ,so we introduced a function hangman_graphic that is called whenever the attempts remaining are decremented and displays stages of hangman and when the attempts are over then a complete graphic of hangman is displayed!
Following is the function code:-
def hangman_graphic(attempts_remaining): if attempts_remaining == 5: print ("________ ") print ("| | ") print ("| ") print ("| ") print ("| ") print ("| ") elif attempts_remaining == 4: print ("________ ") print ("| | ") print ("| 0 ") print ("| ") print ("| ") print ("| ") elif attempts_remaining == 3: print ("________ ") print ("| | ") print ("| 0 ") print ("| / ") print ("| ") print ("| ") elif attempts_remaining == 2: print ("________ ") print ("| | ") print ("| 0 ") print ("| /| ") print ("| ") print ("| ") elif attempts_remaining == 1: print ("________ ") print ("| | ") print ("| 0 ") print ("| /|\ ") print ("| ") print ("| ") elif attempts_remaining == 0: print ("________ ") print ("| | ") print ("| 0 ") print ("| /|\ ") print ("| / \ ") print ("| ") else: print ("The noose tightens")
print ("GAME OVER!")
Thank you,
By:-Siddhesh Ramajgol (L-57)
Good logic!!
ReplyDeleteNew topic nice
ReplyDeleteThanks continue to check out
DeleteGood one
ReplyDeleteSuperb blog 👍
ReplyDeleteThank you so much
DeleteInteresting!
ReplyDelete