Programming with Python

The best way to learn how to program is to do something useful, so this introduction to Python is built around a common scientific task: data analysis. Our real goal isn’t to teach you Python, but to teach you the basic concepts that all programming depends on. We use Python in our lessons because:

  1. we have to use something for examples;
  2. it’s well-documented;
  3. it has a large (and growing) user base among scientists in academia and industry; and
  4. it has a large library of packages available for performing diverse tasks.

But the two most important things are to use whatever language your colleagues are using, so that you can share your work with them easily, and to use that language well.

Prerequisites

To begin tackling this lesson, you will need to:

Schedule

Setup Dowload files used on the lesson.
00:00 1. Running and Quitting How can I run Python programs?
00:05 2. Variables and Assignment How can I store data in programs?
00:15 3. Data Types and Type Conversion What kinds of data do programs store?
How can I convert one type to another?
00:25 4. Lists How can I store multiple values?
00:35 5. Tuples & Dictionaries How can I add semantic value to my collections of multiple values?
00:45 6. For Loops How can I make a program do many things?
00:55 7. Conditionals How can programs do different things for different data?
01:05 8. Creating Functions How can I define new functions?
What’s the difference between defining and calling a function?
What happens when I call a function?
01:15 9. Errors and Exceptions How does Python report errors?
How can I handle errors in Python programs?
01:20 10. Live Coding Shielding Problem How can I perform a shielding calculation using Python?
02:50 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.