Intro to Programming and Data Analytics with Python


If you got that working, great! (still read the following!) If you didn't, that's not at all unusual! There's a few of things that might be wrong:

1) You might have mis-typed the program. Go through and make sure it is typed as suggested, especially that there's no spaces in front of the text.

2) The other thing is that you may have used the wrong capitalisation in either the filename or the command prompt command. Check these. This matters less on Windows, but you should try and get it right anyhow as it matters for some languages.

3) Check that the text editor hasn't saved the file as HelloWorld.py.txt. On Windows, check the file extensions aren't hidden (info).

4) Anaconda hasn't installed properly -- try reinstalling it *and* reopening the command prompt/terminal.


It is worth making an important point at this point: the difference between people who become programmers and those who don't is very clear: it is about how you respond to problems.

Beginners imagine that coders sit down, type perfect code, run it, and the job is done. This isn't what programming looks like at all!

Programming is people sitting down, writing code, and then spending between 50 and 80% of their time *fixing* the code so it works. This is because computers need talking to very carefully -- they're just a box of wires, so they can't do all the guessing and interpretation humans can do.

You need:

As human beings, we're not use to this, and everyone, *EVERYONE*, makes mistakes -- this is a good thing: if you didn't make mistakes, you'd be a robot, not a human. All that happens when you become a good programmer rather than a beginner is you spot the simple mistakes earlier, and make harder mistakes because you try crazier stuff.

We call typos and error of program logic "bugs" and the process of fixing them "debugging". The difference between people who succeed at coding and those who drop programming is how relaxed and accepting of their bugs people are.

People who struggle think that bugs reflect how bad they are at coding (rather than how good a human being they are); coders, on the other hand, welcome problems -- they delight in having to solve problems and welcome the challenge. Once you get to this point, you're a coder.


Try making some errors in your program (mis-spelling print; changing the punctuation), then re-save the file (don't forget this!), and re-run it. See what messages it gives you.


Now we'll look at another way of running Python; one much more useful for data analysts.

  1. Start
  2. Get the software
  3. Writing our first program
  4. Debugging
  5. iPython Notebook <-- next
  6. Data Analysis