AuroraCollegeSDD2020 / at2-hangman-project-press-f-to-pay-respects

at2-hangman-project-press-f-to-pay-respects created by GitHub Classroom
GNU General Public License v3.0
0 stars 0 forks source link

Code algorithms #8

Open CaitlinJohansson opened 6 years ago

CaitlinJohansson commented 6 years ago

The code of which to be created to make the hangman game to work in the way needed.

CaitlinJohansson commented 6 years ago

Ya boi has the code right here although it doesn't say you win so I'm not closing this yet:

import random c = 0 listy = ["chicken", "crow", "stork", "pigeon", "swan", "duck", "peacock", "parrot", "sparrow", "toucan", "penguin", "owl", "hummingbird", "seagull", "ibis", "emu", "kingfisher", "kiwi", "kookaburra", "dove", "conary", "puffin", "albatross", "eagle"] z = (random.choice(listy)) letterlist = [ch for ch in z] guess = input("Welcome to hangman! A game that will make you pick letters until you get it right. Our theme here is birds. Mostly around the Australian area, some are also around other places too. Now, pick a letter or word to get started and see if you are wrong or right!" ) print((len(z) * str(' _ '))) while guess != z: if guess in letterlist: print(guess + ' is in the word!') guess = input('Guess again!' ) if guess == z: print("You guessed the word! You win!") break else: print(guess + ' is not in the word. Guess again.') c += 1 print("You have used " + str(c) + " guesses") guess = input('Guess again!' ) if c == 10: print("Oh no! The man has been hung try again next time.") break

CaitlinJohansson commented 6 years ago

This is the current version (updated)

import random c = 0 listy = ["chicken", "crow", "stork", "pigeon", "swan", "duck", "peacock", "parrot", "sparrow", "toucan", "penguin", "owl", "hummingbird", "seagull", "ibis", "emu", "kingfisher", "kiwi", "kookaburra", "dove", "conary", "puffin", "albatross", "eagle"] z = (random.choice(listy)) letterlist = [ch for ch in z] print((len(z) * str(' '))) guess = input("Welcome to hangman! A game that will make you pick letters until you get it right. Our theme here is birds. Mostly around the Australian area, some are also around other places too. Now, pick a letter or word to get started and see if you are wrong or right!" ) print("There may be an unexpected delay when you get the wrong guess as the graphics are loading...") if guess == z: print("You won! On your first guess too!") else: while guess != z: if guess in letterlist: print(guess + ' is in the word!') guess = input('You got it right! Guess again!' ) if guess == z: print("You guessed the word! You win!") break elif guess == z: print("You guessed the word! You win!") break else: print(guess + ' is not in the word. Guess again.') c += 1 guess = input('Guess again!' ) print("You have used " + str(c) + " /10 guesses") if guess == z: print("You win!") break elif c == 1: print("____") elif c == 2: print("""
_____""")
 elif c == 3:
     print("""|-----------
_____""")
 elif c == 4:
   print("""|-----------
o
_____""")
 elif c == 5:
   print("""|-----------
o
_____""")
 elif c == 6:
   print("""|-----------
o /
_____""")
 elif c == 7:
   print("""|-----------
o / \
__""")
 elif c == 8:
   print("""|-----------
o / \ /
_____""")
 elif c == 9:
   print("""|-----------
o / \ /\
_____""")
 elif c == 10:
   print("""|-----------
o / \ /\
Game Over
_____""")
   print("Oh no! The man has been hung try again next time.")
   break