Lectures | Computer Concepts and Practice 2013 Spring | SNU

LEC # TOPICS HANDOUTS AND EXAMPLES
1 Introduction

Getting started (PDF)

raw_input_example.py (repl.it)

2 Conditionals, loops

How to comment code properly (PDF)

height_example.py (PythonTutor.com | repl.it)

conditional_examples.py (PythonTutor.com | repl.it)

loop_examples.py (PythonTutor.com | repl.it)

3 Defining functions

lecture3.py (PythonTutor.com | repl.it)

functions.py (PythonTutor.com | repl.it)

check_for_vowels.py (PythonTutor.com | repl.it)

4 Strings, lists, list comprehensions

string_examples.py (PythonTutor.com | repl.it)

list_examples.py (PythonTutor.com | repl.it)

comprehension_examples.py (PythonTutor.com | repl.it)

Additional Material

Two examples of a rock-paper-scissors program:

rps_example1.py (PythonTutor.com | repl.it)

rps_example2.py (PythonTutor.com | repl.it)

How to use while-else loops (suggestion: don't use them at all, but if you do be aware they work differently than you might think):

while_else.py (PythonTutor.com | repl.it)

Optional lecture Recursion

Recursion notes (PDF)

Recursion examples (PythonTutor.com | repl.it)

Optional problems (PDF)

Solutions to optional problems (1 | 2 | 3 | 4 | 5 | 6 | 7)

5 Tuples, dictionaries, common Python mistakes

tuple_examples.py (PythonTutor.com | repl.it)

Remember that the keys of a dictionary must be immutable objects, but the values of a dictionary can be either immutable or mutable objects.

Common Python mistakes and misconceptions (PDF)