Skip to content

Latest commit

 

History

History
182 lines (129 loc) · 6.2 KB

README.md

File metadata and controls

182 lines (129 loc) · 6.2 KB

Berlin Python Course 2024

Here is the repo.

Why I teach this course

This course takes 2% of my year.

Success rate is about one person per year. And that's ok.

Knowing how to program is like having a super power.

Programming gives you a tool that you can use to make other tools.

I put in a constant effort, and you get a super power forever.

You have to believe what I tell you. I have 40 years experience and you have zero :-)

You have to have the right attitude!

You are in fact very close to being programmers, you just don't know it.

Programming is actually pretty simple

It's all just common sense. Think about how you would do something in the real world, then do that in the computer.

Things that make programming seem hard are: weird names, weird details, frozen accidents.

Programming is often dressed up to look harder than it is. People with knowledge making themselves seem important and protecting their positions.

It might look like there are big differences between you (and the others in the class), but that's not the case at all. Not in what you already know and not in your aptitude, since what's mainly needed is clear thinking and common sense.

If you don't understand something, probably half the people in the room don't either. Please speak up!

There are very few control flow things (if/then/else, looping).

There are very few data structures (lists, sets, dictionaries).

These things are just fancy names for things you have been doing every day for your entire life.

Almost all programs start out and then grow in the same way. From something very simple. From an itch. They always look complex when you arrive late, after many incremental rounds of development.

Many things are packaged up, easy to install, well documented, and show example usage.

All programming languages are (more or less) the same.

General comments on programming

It's actually really great to know nothing and to have no background. There is no stronger position. No one assumes things about you, there are no dumb questions, you don't have to pretend, you can learn without acquiring bad habits.

We're all piecemeal in our knowledge because this is not our job. That's ok. It means within a short amount of time of starting you will know things that (more experienced) others will not, and that, in reverse, people who overall know much less than you will know more about some aspects than you do. Don't be arrogant, help one another.

I only know things piecemeal because I never really made computers my job. You'll always be piecemeal too. It means you'll always have holes, people will always know more than you do. It means you'll complement others and vice versa. Be humble, be useful.

I have to look things up all the time!

Information processing is fundamental. Evolution shapes us to efficiently process information. Now we've reached the point where a species can build machines that simulate other machines and write programs to run on them to process information however we like. It's quite extraordinary. Working with information is somehow so fundamental. It's like math, only even more general.

Being able to write code is really a general skill that is likely to be of use to you no matter what your occupation is.

Description of course, aims, beliefs, etc.

Broad range of students in the class. Help each other. Be generous. Close the gaps. Make yourselves into a little community. Self support, teach, etc.

Solve problems just over the horizon of what you can do without programming.

This is a course for beginners. If you're not a beginner, you're expected to help others.

Learn by solving real problems, not in a dry, theoretical way.

In an academic context, generating figures seems to be the gateway drug to becoming a programmer.

Course aims

Get you "over the hump" and turn you into a programmer (or a better programmer).

Get you using the shell (more or less) efficiently.

Get rid of fear.

Show you how to help yourselves.

Show you what's possible - breadth not depth. There are lots of moving parts to understand - let's not get hung up on too many of them. The idea is to get you programming and then give a broad sweep of what's possible.

When non-programmers working with data run into a problem they cannot solve with pre-existing tools (e.g., Excel), the reaction is usually either to ask someone else for help, to do it manually, or to give up. In this course we will add another option: write a program. The course aim is concrete and modest: turn you into someone who, when faced with a data problem, thinks "I can write a quick script to solve that problem" (and then does so). Many people go back to their regular lives after taking courses, don’t put into practice what they learned, and eventually forget it all. I don’t want that to happen with our course. We'll aim to turn everyone into an active programmer. To get you going on a path that fundamentally changes how you work with data for the rest of your career. It’s impossible to learn everything about programming in a week, but it is possible to take the crucial first steps and to make them stick.

Topics

There are three things that are closely tied together in what you’ll be doing in the course. 1) You'll write code in the Python language. 2) You'll do that in a text editor. You'll then 3) run those programs on the command line (using bash).

Why learn about two languages (Python and the shell), isn't one hard enough?

Python

Go to our Jupyter Lab site, at https://civ.wtf.

  • Jupyter notebooks
  • Plotting
  • Whitespace is important!
  • If/elif/else
  • While loops
  • Standard input and output
  • Variables / Lists / Sets / Dictionaries
  • Importing modules - like using a cookbook
  • Simple programs
  • Functions
  • Exercises
    • Common words
    • Hangman
    • Guess a number
  • Classes - are exactly like factories
  • Pandas

If you have access to BIH, you can run Jupyter on their servers.

Shell

  • Wildcards
  • Pipes
  • Input / output redirection
  • Variables
  • Loops
  • Common commands
  • Using the command-line efficiently in the shell
  • Git and GitHub
  • Snakemake

Other tools

  • Version control
  • GitHub