Advertisement
JkSoftware

Day 7 - Hangman start

Nov 10th, 2021 (edited)
947
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3.  
  4. wordlist = ["ardvark", "baboon", "camel"]
  5.  
  6. #todo #1 randomly choose word from list and assign it a variable
  7. #todo #2 ask user to guess a letter and assign it a variable
  8. #todo #3 check if letter is in the chosen word
  9.  
  10. hangword = random.choice(wordlist)
  11. print(hangword)
  12. userguess = input("Guess a letter ").lower()
  13. for letter in hangword:
  14.     if letter == userguess:
  15.         print("Right")
  16.     else:
  17.         print("wrong")
  18.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement