Python
Getting Started

Overview

Experiment with Python

Resources

Exercises

Open a unix terminal window and run the "idle" IDE.
  1. Get Python to write "hello world".
  2. You may want to experiment with examples shown on the lecture slides at this point.
  3. Complete this word count progam so that it counts the number of words in a file:
    def wc(name):
      """Count words in a file.
    
      The parameter is the name of a file to count.
      Returns a dictionary giving the counts for each word found.
      Words are delimited by whitespace. This is not perfect;
      for example, in 'cats, not dogs" we get a word 'cats,'."""
      h = {}
    
      return h 	
    	
    Python String API and Array API May prove helpful in doing this