Things you can do with Python

Here is a Python assignment from a journalism class at Stanford:

Build face-grep in Python

Go ahead, look at it. Don’t get scared. Just look at it and try to understand the concepts.

You could actually DO this assignment. You could.


What students said about this course in spring 2014

These are bona fide, unedited student comments from the official UF student course evaluations site. Those with no answer or “n/a” or “none” have been omitted. Students were all undergraduates in journalism or advertising who had no previous programming experience. Only eight students were enrolled in this course.

Qualities of instructor which contributed to success of the course:

“Her enthusiasm and clear description of the course and how much time we would have to devote to it to be successful.”

“She is very passionate about the course and the material which makes me what to learn more about the material as well.”

“Her enthusiasm for the subject material and our understanding of it made difficult course material easier to understand. She was always willing to give additional help, even outside of class and after work hours. The class was also broken down really intelligently so that we had a good foundation for more difficult material later in the course.”

“Ms. McAdams encouragement to play with code helped with my success in this course.” Continue reading

How we use algorithms

Many students had difficulty figuring out how to code the number guessing game in class on Monday, Feb. 24.

You already know ALL of the building blocks of programming. This is (pretty much) everything:

  • variables
  • functions
  • if statements
  • loops (for and while)

So here is something else to think about:


An algorithm is like a recipe: a step-by-step process for performing some activity. You may look at an algorithm as the steps your program goes through to solve a problem. For example:

High Score Algorithm

  1. Game is over
  2. Compare player’s score to high score
  3. If player’s score is greater than the high score then the high score variable is reassigned the player’s score
  4. Display new high score

There are algorithms that exist for many common programming problems such as sorts and indexes. (source)

This is the problem-solving method you will need to develop. When I told you “break it down,” this shows one example of breaking down a problem that needs to be solved. What do I want to do? I want to tell the player if she has the high score. How do I find out of she has the high score? And so on.

You must first reason through the TASKS you want to do. THEN think about the code you will need to write to make it happen.


Imagine a dice-throwing game: Any player who gets doubles will win.

  1. Player throws two dice.
  2. Computer throws two dice.
  3. Did both get doubles? (What happens?)
  4. Did only one get doubles? (What happens?)
  5. Did no one get doubles? (What happens?)

Now, the algorithm:

  1. Throw two dice for the player. Save two numbers, possible 1 through 6 for each.
  2. Throw two dice for the computer. Save two numbers, possible1 through 6 for each.
  3. Compare two faces of the player’s dice to check for doubles.
  4. Compare two faces of the computer’s dice to check for doubles.
  5. If no one has doubles, announce or print that.
  6. If both have doubles, announce that it is a tie.
  7. If the human has doubles, announce that the human wins.
  8. If the computer has doubles, announce that the computer wins.

The order of 5 through 8 might change, depending on how you want to write your if-statement.

Here is another example (a very simple one).

You can do this in either Python OR JavaScript! Give it a try!


Double major in journalism and computer science

This quote —

… the fields of mathematics, statistics and computer science are ever more important to the emerging fields of data journalism, information graphics, and news applications. That’s where the jobs are. That’s where the industry is heading (arguably, already it’s already there). That’s the new quality and standard to which we need to hold journalism.

We’re never going to fill these jobs or really make impact in this space and push forward if we don’t properly teach and prepare the young’uns coming up. Myself included.

— comes from an article written by a journalism student. You should read it:

Re-thinking J-school, by Katie Zhu.


Do you feel like writing code is still hard for you?

In this very amusing blog post (you must read it to the end!), by student Michelle Bu, you’ll find out how hard her first coding experience was for her:

21 Nested Callbacks

I was laughing out loud as I read it.

I’ve realized that with each piece of code I’ve written since my triangles, I’ve only gotten better at “Googling it,” debugging, and being generally competent about miscellaneous programming topics–and it’s all because I saw each and every silly project through. — Michelle Bu

So 21 months ago, she didn’t even know how to write a loop. Now she’s a Ph.D. student in computer science.

Here is her first attempt (21 months ago), and here is her new, responsive, fabulous version.

Check out Michelle’s Projects.


Other ways to learn Web stuff

CodePen’s Pattern Rodeo offers you a fun way to test your skills. The weekly contest ran for four weeks. Each week had a different theme. Check out the winners! When you click the winner’s name, you can see (and copy) his/her CSS and JavaScript.

CodePen is a website where you can view other people’s CSS and JavaScript and HTML. It’s a great place to explore. You can look around as much as you want without signing up for an account. Or sign up (it’s free) and play there yourself.

Another fun place to play around is Mozilla Thimble. Some of the stuff here is too simple for you now, but there’s lot’s of good HTML know-how here that might be new to you. For example, learn about CSS positioning by playing with zombies!

Another part of Codecademy is the APIs section. There are projects here that let you use Python. There are some other projects for JavaScript. In these projects, you can learn how to build apps. Yes, apps!


Code inspires us

Watch this. Be inspired.