Introduction to Computer Programming (UA-0002.002)
Fall 2013 -- Section 2: Python
Professor: Andrew Case
No outside materials are allowed on the exam. You will be provided with some Python documentation (subject to updates) for use during the exam.
- Copying data structures: - references vs. copying - copying lists - copyting tuples (why not?!) - copying sets - copying dicts - Sequence functions: - del, min(), max(), len() - Nested data structures
- File functions - open() options (r,w,r+,a,b,t) - file.close() - Text I/O - read line by line - read entire file - read certain size - write data out - Functions: seek(), read(), write(), - Binary I/O - Pickling - reading a variable or data structure - reading multiple data structures - functions: dump(), load()
- When to use with user input? - When to use otherwise? - keywords: try, except, finally
- When to use it - what is the limiting factor - Comparisons - factorial - fibonacci - fractals - Algorithm design - Define algorithm using itself - Variable scope - Base case - Recursive case - Must get closer to the base case - Infinite recursion - cause and avoidance of - repercussions - Examples in code: - Factorial, fibonacci, box, spiral, etc. - Advantages and disadvantages vs. iteration