Session 2: Introduction to Python
Session 3 – Data structures, File I/O, and stock functions
- Concepts
- Lists and Dictionaries
- Reading from a file
- Calling functions
- Background/Overview
- Completed intro to Python. Can declare variables, use conditionals, some loops, and print to screen.
- Lesson Plan
- Lists
- Index’s start at zero, not one.
- How to create a list.
- What kinds of data can exist in a list?
- List methods.
- Append, count, index, remove, reverse, sort
- Dictionaries
- What’s the difference between a list and a Dictionary?
- Dictionary methods.
- Clear, get, has_key, items, keys, values
- File I/O
- Reading input from console
- File methods
- Open, readlines, in, write
- Closing
- All together
- Read text from a file, put the information into a Dictionary, print the Dictionary to consol.