Skip to main content
CS Teaching Tips

Main navigation

  • Browse All Tips
  • Tags
  • 3D
  • About
  • Rate Tips
  • Tip Sheets

Have students write a game of Hangman in Python in which the computer cheats by changing its secret word to give students practice using dictionaries.

Share Have students write a game of Hangman in Python in which the computer cheats by changing its secret word to give students practice using dictionaries. with FacebookShare Have students write a game of Hangman in Python in which the computer cheats by changing its secret word to give students practice using dictionaries. with Twitter
  • Each time the user guesses a letter, the computer checks a dictionary to see if there is another word consistent with previous guesses that does not contain the new letter.
    • If so, the computer will change its secret word to this new word, cheating.
  • See the Duke version of this assignment for inspiration on implementing this assignment in your classroom.

More about this tip

Tags

  • Meaningful and Relevant Content
  • Python
External Source
Duke Clever Hangman assignment by Owen Astrachan.
Other Tips By
Other Tips By Owen Astrachan

Similar tips

Play musical chairs to explain while loops so students develop physical experience navigating through the structure of a loop to better understand while loops.
Have students develop a geographic visualization of Twitter data across America in Python to give them experience using dictionaries, lists, and data abstraction techniques.
Be careful when using coin flips and gambling in examples to avoid offending students with moral objections to gambling.
  • CSTT Facebook
  • CSTT Twitter

For more information or to report a bug, contact us at admin@csteachingtips.org. Built with Bootstrap. Footer Icons by Mohammed Alyousfi. Powered by Drupal.

Privacy Policy

  • National Science Foundation
  • Sage Fox Group
  • Harvey Mudd College