Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: color selector

  • Create a file similar to the colors.txt file and use it as the list of colors in the earlier example where we prompted for a color.
  • Call the new script color_selector_file.py
blue
yellow
white
green

Extend the previous example by letting the user provide the name of the file on the command line: python color.py examples/files/color.txt