About
Programming

What's a Program?

Here's One!

import urllib.request, json

# we're going to ask tumblr for some posts ...
search_tag = 'cat'
api_key = 'XBu4Lke6Cyh2UrLFIZW0jIo79sUT8EwtruJduMAknEUNhccNwY'
post_type = 'text'
url = 'http://api.tumblr.com/v2/tagged?api_key=' + api_key 
url = url + '&tag=' + search_tag

response = urllib.request.urlopen(url).read().decode('utf-8')
posts  = json.loads(response)['response']

for post in posts:
    if post['type'] == 'photo':
        tags = post['tags']
        photo = post['photos'][0]
        number_of_tags = len(tags)
        if number_of_tags > 2:
            print(tags)
            print(photo['original_size']['url'] + "\n\n")

A Quick Exercise

This program prints out photo posts from tumblr that have at least two tags, with "cat" as one of those tags.

(You can try this out too if you have your laptop and can follow along)

One simple description might be: a set of instructions that tell the computer to do things.

A Formal Definition

program - a sequence of instructions that specifies to a computer actions and computations to be performed

This Course is About Programming, not Just Programs

Programming

Programming Can Be:

But It's Really Just Problem Solving

Why Would You Want to Learn How to Program?

Why Else?

Great, I'm convinced! Sign me up!

Let's talk about what these programs run on