Skip to content

For the Intro to Python Programming course at CS @ Illinois SAIL 2017.

License

Notifications You must be signed in to change notification settings

andrewyang96/HangmanGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HangmanGame

For the Intro to Python Programming course at CS @ Illinois SAIL 2017.

Wordlist Source: http://www-personal.umich.edu/~jlawler/wordlist

Tutorial Topics

  • Print hello world
  • Variables
  • Types
  • Operations
  • Casting
  • Lists
  • Strings
  • Sets
  • Input
  • If, elif, else statements
  • For-loops & while-loops
  • List comprehension
  • Map function & filter function
  • Exceptions & try-catch blocks
  • Functions
  • Modules
  • File I/O

Program Structure

Each line of pseudocode will have this structure:

Line of pseudocode [topics covered]
Import string of lowercase letters from "string" module [modules]

Ask for number of attempts, make sure it is positive and less than 26 [input, casting, decomposition, exceptions]
Open words file & select random word [file I/O, lists, modules, scalability (if there is time remaining)]

While there are attempts or letters remaining [while loop]
    Print the current state of game [for loop]
    Ask for next letter, make it lower(), make sure input is a single letter that hasn't been guessed before [input, decomposition, exceptions, sets]
    If letter is in the word [sets]
        Notify user that the letter is in the word [string interpolation]
    Else
        Decrement attempt counter [decrement operator]
        Notify user that the letter is not in the word [string interpolation]

If word is solved
    Notify user of win
Else
    Notify user of loss

Give player the option to try again

About

For the Intro to Python Programming course at CS @ Illinois SAIL 2017.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages