Skillshare intro to Python/Unit 5

Revision as of 19:34, 13 June 2013 by imported>Jesstess

Goal #1: reading from files

To get some more practice with reading from files, we're going to read, run, and extend some Python scripts.

Countries example

Here are the text file and Python script from the countries example from the file lesson:

Please download both files and save them to your Desktop. Review countries.py, make sure you understand it, and then run it!

Then, add code to the file to answer the following questions:

  • What are all of the countries that end in "land"?
  • What is the shortest country name?


Wordplay example

Here are two new files. The first, sowpods.txt, is the official Scrabble wordlists we'll use for our Scrabble cheater. The second is a Python script that uses data from sowpods.txt to find weird and interesting words:

Please download both files and save them to your Desktop. Open wordplay.py, see if you can guess what it does, and then run it!

Then, using the existing code as a template, add code to the file to answer the following questions:

  • What are all of the words that contain "VV"?
  • What are all of the words that contain "Q" without a "U"?
  • What are all of the words that contain all of the vowels and Y, ("A", "E", "I", "O", "U", "Y") in any order?

What other weird words can you find?