Course Introduction: Syllabus Calendar This class: Algorithms are a set of steps a computer can follow I'm assuming one of the following: A. You took CS110 or CS108 B. You are good at math This class doesn't assume prior programming experience - But it moves faster than CS108 Python is different from Java, so it should be entertaining regardless Comparison with CS108: Algorithms are introduced in Python, not with Alice or flowcharts Assignments (excepting the first) will be more advanced Python demo! Python is a language - Python is NOT a program - There are multiple interpreters for Python - Math folks think about formal language definitions IDLE works Python can run be run on the command line I'll normally demonstrate from the command line Let's calculate something easy! - It works like a calculator if you want - Tire aspect ratio For future reference, the procedure presented here is: Open a command line (terminal) Create your program with gedit or vim or whatever ("gedit program_name.py") Save your program Run it with Python ("python program_name.py") Alternative: "python3 program_name.py" - Why? "python" on the command line means Python 2, not Python 3 - Your book discusses Python 3 We'll start the class with a superficial overview, and then cover things in depth This may cause anxiety amoung people who didn't take CS108 Read ahead and don't worry too much Demo (Let's play with all the Legos!) print (statements vs. functions) comments Variables Expressions - Adding strings and numbers? "if" statements Loops Functions (built-in) Functions (define-your-own) Lists Concerning Python: Reference is to Monty Python - Many examples in the official documentation refer to this Saves you time, uses extra computer time - How much extra time? Let's find out! In exchange for bad performance, you get: - Less bugs - Faster to program - Code readability - Flexible and self-aware type system - Portability Is it worth it? Depends. - I wrote GNA in Python, and I'm glad it works - If I could make it be in C, I would. When is Python appropriate? Most common hangups: Not sure where to start - This requires creativity - Break the problem into simple pieces Not aware of what code is doing - Stop and think Debuggers: They're useful for debugging... pdb will be integrated into 111 - First time