Skip to content
Home » University of Michigan » Python for Everybody Specialization » Programming for Everybody (Getting Started with Python) » Weel 3: Chapter One: Why We Program (continued)

Weel 3: Chapter One: Why We Program (continued)

The first chapter offers a comprehensive overview of programming, serving as a roadmap for the remainder of the book. While some concepts may initially seem challenging, this broad chapter aims to lay the foundation for deeper understanding. For optimal clarity, consider reviewing the corresponding chapter in the book alongside these lectures. Revisiting these lectures later, after progressing through further chapters, can be particularly beneficial.


Lecture materials


Video: 1.4 – Writing Paragraphs of Code

Summary of Chapter 1: Introduction to Python Programming

This chapter provides a broad overview of what you’ll learn in the Python programming course. It introduces key concepts like:

  • Interactive Python and Scripts: You can talk to Python directly (interactive) or write programs in files (scripts).
  • Vocabulary: Programming languages have reserved words with specific meanings (e.g., import, for, if).
  • Syntax: Programming uses specific formatting rules (e.g., lines, indentation).
  • Basic Patterns: Programs are built from four basic patterns:
    • Sequential: One step after another.
    • Conditional: Do something based on a condition (e.g., if x < 10).
    • Repeating: Do something multiple times (e.g., while, for loops).
    • Storing and Retrieving: Save and access data later.
  • Example Program: The chapter illustrates these concepts with a simple program that counts the most common word in a file.

Key Takeaways:

  • Don’t worry about understanding everything now. The course will gradually build upon these foundational concepts.
  • Pay attention to vocabulary and syntax to write correct and meaningful Python code.
  • The basic patterns are building blocks for more complex programs.
  • Focus on learning step-by-step. It will become clearer later in the course.

This chapter sets the stage for further exploration of Python programming in the upcoming chapters.

Here’s a tutorial on “Introduction to Python Programming”:

Welcome to the world of Python!

Python is a powerful and versatile programming language that’s loved for its simplicity and readability. It’s used for everything from web development and data science to machine learning and automation.

In this tutorial, we’ll take you through the basics of Python programming, starting from the ground up.

Here’s what we’ll cover:

1. Getting Started with Python:

  • Installing Python on your computer
  • Using an interactive environment to experiment with code
  • Writing and running your first Python script

2. The Building Blocks of Python:

  • Variables: Storing data for later use
  • Data types: Numbers, strings, lists, and more
  • Operators: Performing calculations and comparisons
  • Control flow: Making decisions and repeating actions

3. Essential Python Concepts:

  • Functions: Organizing and reusing code
  • Loops: Repeating tasks efficiently
  • Conditional statements: Making choices based on conditions
  • Modules and packages: Importing and using pre-written code

4. Working with Data:

  • Reading and writing files
  • Handling user input
  • Working with lists and dictionaries to store and manage data

5. Putting It All Together:

  • Building simple Python programs, such as:
    • A calculator
    • A text-based adventure game
    • A program to analyze data from a file

Throughout the tutorial, you’ll have plenty of opportunities to practice what you learn with hands-on exercises and coding challenges.

Ready to start? Let’s dive in!

So welcome back. Now we’re going to start learning about the Python language and you can think of this as talking to Python itself. And it turns out that there is a way on most computers – whether it’s a Windows computer and command line or a Macintosh
or Linux box – to get Python started. And if you just run Python, it will take, interactively, commands that you can type. And you have to type “python” at this chevron prompt, is what we call it, but this also sort of fits into what next. So Python is like “Okay. I’m here. I can handle any Python statement you can send me. I’m ready to do whatever it is that you want to do. I don’t know what to do. I need you to tell me what to do.” And so you can type a series of statements in Python. And so the first statement that you might type
is an assignment statement; x equals 1. And so what is going on here? Now this, this assignment statement is something that often confuses people when they move from math to programming. An equal sign sort of has a direction to it; it’s an arrow. It really is saying “Dear Python, you’ve got a lot of memory – you’ve got a lot of memory. Take a little tiny piece of that memory
and remember it and name it x. I might use that – I’m going to use that later –
and stick a 1 in it.” So this is sort of like stick 1 in a
spare place in memory and name it x. print (x) says, go take whatever that spare bit of memory was and bring it back out
and tell me what I put in it. Now, it’s kind of redundant, but usually you’re doing something
more complex than this. Put something in memory and then take it back out; that’s the first thing. Now what this is doing is this is
an expression and that says take whatever’s in x, which is a 1, and then add 1 to it, which becomes 2, and then stick it back in x. So that adds 1 to x and then we print that out
and it’s a 2 and then we quit. Now if you type wrong things here, you’re going to get syntax errors. And Python is just going to tell you,
you know, syntax error, syntax error, syntax error, and away you go. But this is us talking to Python. So what do we say to Python? You can almost think of this as like
writing an essay where you start – and if you think back, you started learning an alphabet and then
you used that alphabet to produce words and then used the words to produce sentences and then you combined sentences to make paragraphs, which then make a story. And we’re going to do the same kind of thing. This is the program that we’re ultimately going to write. And don’t worry about understanding what this story does. We’ll talk about this later, we’re going to come back to this many times throughout the course. This is a Python story about how to count words in a file in Python. Okay? This solves that problem that I asked you to solve a little while back of what the most common word was
and how many there are. And we’ll come back to this several times in this course. So if we start at vocabulary, the first thing we have in every programming language
is what’s called reserved words. Now, what do we mean by reserved words? Well, these are words that if we use these words, we must use them to mean the thing
that Python expects them to mean. Another way to put that is we can’t use them elsewhere. We can’t make up a variable named import. We can’t make a variable named assert; because if Python sees assert, it means something very specific to Python. If it sees if, it means something. If it sees for or pass or while – where is while? There is while. These mean things. The best way to think about this is
Python is kind of like a dog. And if you’re talking to a dog and you say hey, dog, do you like, you know, Beethoven or Bach better? The dog is hearing – is like blah, blah, blah, blah, blah, blah – it doesn’t care anything. And then you say hey – hey there, Spot. What do you think of the weather today? Do you really like, you know, sunsets or do you like rain better? And the dog is like blah, blah, blah, blah, blah, blah. And then you say something like do you think
it’s time to go for a walk? And the dog goes, like, walk – got it. And the dog’s been listening to you all along. Most of it is blah, blah, blah, blah, blah, but walk is a reserved word for a dog. Okay? Food, treat – those are reserved words for dogs. Most of stuff you can say anything you want to a dog and they’re very good listeners, right? But when you say a reserved word for a dog and you say walk and you don’t deliver and then
that dog’s gonna bug you for a while. So you can think of that as Python. When Python sees global or from or for, it’s like whoa – that’s a word that means a lot to Python. So you’d better use it the way Python expects you to use it. Sentences are lines. And so when we write a program, we’re writing a text file and we put a line
and another line and another line. Each one of these is like a separate line
and we’ve got to get them right. And then we construct a paragraph out of a series of lines. And so in this particular example, we have another assignment statement that’s
sticking the number 2 into the variable x, retrieving that 2 back in, adding 2 to it and sticking that sum back into x. Print is a function and there is a parameter x and that’s going to cause 4 to be printed out. So we’re using operators, this plus is what’s called an operator, the equal sign is what’s called an operator. This print is actually a function. This is a parameter being passed into the function. So there’s a whole series of different kind of syntaxes that we use to produce the lines that we have to produce. Now we start combining these – the lines
into paragraphs and make some sense. And so that interactive Python, where you’re talking with the three chevron prompt – that’s fun and it’s fine to get started and type x equals
and x equals x plus 1 and whatever. But don’t do too much. And I see students all the time, they try to write whole programs in that and it gets a little frustrating because you have to type it
perfectly from beginning to end. It’s much more common to type something in a file. Once we get maybe beyond three lines of Python, we tend to just use a programming text editor
like Atom or something and we put them all in a file and then we tell Python – start at the beginning of this file
and then read through the file. We call this a script or a Python program. And in Python, we tend to call that file .py. And some text editors, like the Atom text editor which is one of those that I recommend, when you have a file that ends in .py, it syntax highlights it and gives you colors, and makes things pretty and helps you understand and sometimes even leads you towards syntax errors and mistakes that you have. And so scripts are stored sets of instruction in text files that you can
then hand to Python to run them. And I have a whole bunch of videos that sort of get you to learning Python – getting Python installed, doing something interactively, and then writing
a script and then running from the script. So like I said, you can do interactive in Python or you can run a script. And a script is much more common. Once you – after about the first 15 minutes, you pretty much do everything with a script. So what do you put in that script? Well, it’s a series of steps. Now there are a couple of basic patterns that we use
and we compose them. The most basic pattern is what’s called sequential. We do one thing, then we do the next thing,
then we do the next thing. Conditional is sort of intelligent where you’re doing something and then may or may not be doing something. Do, do, do, something, something, something, maybe not, maybe – and you have this “if”. If this is true, do this statement; if it’s false, do some other statement. Those are called conditional steps and we’ll
show you how – in a sec how those look. And then the real power of computers come when we tell it to do something over and over and over again
a million times, if necessary. And that’s when we have a series of steps that need to be repeated. And then the fourth pattern is the store and retrieve pattern, which we will visit in Chapter 4. So this is an example of a four-line
Python program that has four basic steps. Python, we – as if you typed these four lines into a file and then told Python to execute them. Python will stick 2 in the variable x, then it will print that out; our output will be this. It’ll add 2 to it and then print it out again and it’ll be 4. You can – this over here is called a flowchart. I don’t really make you write flowcharts. In the old days they made us write flowcharts. I’m not sure that’s all that valuable. All I’m trying to show you is the sequence of things. It runs this, does something, then it moves onto the next one, does this, then it moves onto the next one, does this, then it moves onto the next one. Meaning that when you’re done with the statement, where are you going to go? Well, in this case, it’s the simplest of all possible things. Where we’re just going from one thing to the next thing. Now, it gets a little more interesting when we do conditional steps. And the thing that makes conditional happen is this if, right? The if statement is a reserved word, okay? And so you’ll see, it starts at the beginning and the if has embedded in it a question that leads to a true or a false, ends in a colon, and then there’s an indented block. And what happens is this is the conditional statement. Print smaller is the conditional statement, meaning that if x is less than 10 evaluates to true, then it’s going to execute; otherwise, it’s going to be skipped. So it can either execute it and continue or it can skip right over it. And so it’s probably easiest to show this on this diagram, where you start with x equals 5, then you hit the if statement and the if statement is asking a question. If the question is true, you go down one road and if it’s false, you go down the other road. In this case, x is 5; so this is true and so we go down this path
and print out smaller and then we rejoin. And the next thing we encounter is another if statement. Is x greater than 20? Well, in that case, it’s no, because it’s not. Because x is 5. So we’re asking the question. We’re not changing x, we’re just asking a question about x. So we skip right over this. So the way this code ultimately runs is it comes in, runs this, sequentially comes to here, conditionally does run this line of code
and then skips completely over it. So it’s this code never ran. And that’s a super simple example. So it said the output is smaller and then finis
and it’s a super simple one. And what you’ll find is we compose these things
to make more complex programs. So conditional is the second of the
three patterns we’re going to see. Now the most exciting pattern is the repeat. And it looks a little more busy because
we can do more stuff with it. So the basic idea is there are a couple of different looping keywords, reserved words – the while and the for. The while loop basically says – it functions kind of like an if statement in that there’s a question in it. It doesn’t hurt n; n doesn’t get changed by this, it just looks at n and asks the question is n greater than zero? If it is true, it runs this code. So just like an if. So up to here, it looks like an if –
if n is true, n greater than zero is true, it runs this code. Now this is a little sequential bit. When you’re done with this, what do you do? Oh, we just fall onto the next one. And you’ll notice that this is indented at
the same level as the print statement. And that’s how we have repeating or even ifs
with more than one statement in it. And then when it de-indents, that’s the end of the loop. And what happens is it runs this and it runs that, but then what does it do? Well, it’s at the end of the loop, so it actually goes back up to the top of the loop. So it goes back up to the while statement. And we actually printed n out, which was 5. And then n became 4 and then it reevaluates
this question – is 4 greater than zero? Yes, it is. So it prints 4 out and
then it subtracts 1 and it becomes 3. Now, is 3 greater than zero? Yes, it is. Yes, it is. And so it goes 4, 3, 2, 1. Then it comes through and it prints 1 and then it subtracts 1 from it, so it becomes zero. Now it comes up and asks this question –
is zero greater than zero? Because n has become zero by the
successive iterations through this loop. So n becomes – is not greater than zero. So this switches from a true to a false. And false, it leaves – goes out and exits the loop. So over here, it goes 5, 4, 3, 2, 1 – and then out she comes. Okay? And as soon as this becomes false, then this loop exits. And so that’s the way we tell a program that – you know, we tell the computer that we want it to keep going
until something has happened. Some – we have achieved something. Who knows what it is we’re doing? None of these – none of these programs make any sense particularly, we’re just sort of learning baby steps. Okay? So loops have this notion of iteration variables to make sure that they are not infinite loops. And this variable n is carefully constructed to start and be checked and then be changed each time through the loop. And that’s how we make sure this loop only runs
five times and not forever. Because you can construct what we call infinite loops that run forever, but it’s not too practical; you just run out of battery or whatever after awhile. So you generally construct loops to finish so that they have to check to make sure that they’re finished. Okay? So if we take a look back at that story, we see that in that story, that is, how you count the most common word in a file and print what the word is and how many there are, you find that there is some sequential code. And in Python, the way you can tell that it’s sequential code is when it’s not being indented – it just goes – it goes down, down, down, down, down. Now the for is another of the reserved words that a loop – so this has a colon and it says that’s an indented block and there turns out to be a for within a for. This is called nesting. We’ll get to that. And then this loop ends and it runs for awhile. And then there’s more sequential stuff. There is a for, which is repeated code. And then there’s an if nested within that for; that’s conditional code. This’ll run for awhile and then it comes out
and does some sequential code. So there is, in this, sequential code, repeated code, and conditional code. So the three of the four basic patterns of programming we see in this file. And so if you look at this from an outline perspective, this is sort of our story. These are the paragraphs of our story. This top bit here says read the name of a file from the user and open that file so we can read it. This second paragraph says oh, as we read through the file, create a histogram that maps the number of words to the frequency of the words
and each time you see a word, update the histogram so that we have a
running total of all of the words, using a thing that we’ll learn later, like in Chapter 10 or 9, called dictionaries. And that’s cool, that’s cool. But don’t worry about it, don’t worry about it, don’t worry about it now. So this is making a histogram. Then once we have the histogram and we’ve read all the words, then we read through the histogram to find the largest. And then we print out the largest word and the largest count. And so this is a little short story with
some sentences and paragraphs and an alphabet and reserved words and vocabulary and all that stuff. And we’re kind of learning how to do it. Don’t try to get this all right now. We’re going to touch on this, we’ve got a whole chapter on variables
and a whole chapter on conditional, a whole chapter on loops. Right? I just – I’m trying to give you this
big picture so that when we get there, you can start putting those things together. And like I said, it’s a little confusing. Generally it really starts to clear up in Chapter 6 and Chapter 7. So just understand that we learn little bits and little pieces and then it gets better toward the end. So thanks for listening. Chapter 1 was really trying to get you an overview of the kind of stuff that we’re going to learn throughout the course and lay down a little bit of vocabulary
so I can talk about things like microprocessors and RAM and memory and stuff like that so that you – so I can communicate, say hey, we’re going to do this thing that’s going to do something with this CPU and so that – so you can use that. So I hope you find this value and see in the next chapter.


Assignment: Chapter 1


Video: Demonstration: Doing the “Hello World” Assignment

Summary of Assignment 1: Writing “Hello World” in Python

This assignment introduces the process of writing and submitting your first Python code in the course. Here’s a breakdown:

Environment:

  • You can use a real text editor like Atom and paste the code into the autograder for submission.
  • Alternatively, the autograder itself provides a simulated Python environment for limited use.

Submission Process:

  1. Write your Python code containing the “Hello World” message.
  2. Click “Check Code” to submit the code for evaluation.
  3. The autograder runs the code and checks for errors.
  4. If there are errors, a message and line number are provided for correction.
  5. If the code is correct, the output and a “Desired Output” are displayed for comparison.
  6. Clicking “Done” saves the submission and updates your Coursera grade with a pass/fail (0% or 100%).

Additional Features:

  • The autograder can detect stylistic suggestions like using a specific loop or statement.
  • Teaching assistants can access your submitted code directly for troubleshooting assistance.
  • Forum code sharing is discouraged to encourage independent learning and understanding.

Key Takeaways:

  • This assignment helps you familiarize yourself with the environment and submission process for future coding exercises.
  • Focus on understanding the concepts and writing the code yourself rather than copying from others.
  • Leverage the teaching assistant support feature for personalized help on specific challenges.

Here’s a tutorial on “Writing “Hello World” in Python”:

1. Choosing Your Environment:

  • Text Editor and Python Interpreter:
    • Install Python on your computer (https://www.python.org/downloads/).
    • Choose a text editor like Notepad, Atom, VS Code, or PyCharm.
    • Write your code in the text editor and save it with a .py extension (e.g., hello_world.py).
    • Run the code from the command line using python hello_world.py.
  • Online Python Environments:
    • Options like Google Colab, Repl.it, or online courses’ built-in environments.
    • Allow you to write and run code directly in a web browser.

2. Writing the Code:

  • Open your chosen text editor or online environment.
  • Type the following code:

Python

print("Hello, World!")

3. Saving and Running the Code:

  • Text Editor and Python Interpreter:
    • Save the file as hello_world.py.
    • Open a command prompt or terminal.
    • Navigate to the directory where you saved the file.
    • Type python hello_world.py and press Enter.
  • Online Environments:
    • Follow the platform’s instructions to save and run the code (usually a “Run” button).

4. Expected Output:

  • If everything is correct, you’ll see the following output in the console:
Hello, World!

Congratulations, you’ve successfully written your first Python program!

So, welcome to our first assignment. Our first assignment, of course,
like in all decent programming classes, is printing Hello World. Now we’re going to use the
autograder for this. And so, here we are,
and let me scroll down. We have a demonstration and it’s kind of
matic because that’s the demonstration I’m doing right now,
it’s not all that matters. So, here’s an assignment, and assignments
are a little bit different when you click them because there’s the honor code and
you have to type your name and hit this check box to sort of
point out that you’re human and that you’re the right human, etc. And then it’s going to launch the tool when you press open tool here
in a new window, and here we go. And so, basically,
this is a Python simulated environment. It’s only good enough to do the first
ten chapters, but it’s great. Now, the idea that I have is that you will
actually write the Python on your computer using a real text editor like Atom, and
then just paste the code in here to get graded, but we understand that if
you’re using an iPad or something else like that that this might be the only way
that you’re going to do it, or if you’re in a school or something and they’ve only
got Chromebooks, it’s okay, you can do it. But at some point, like by chapter 11,
you need to have Python, but that’s okay. So some of the buttons that you’re
going to see here, you won’t see, these are the teaching assistant and configuration buttons, but you will see
the check code and the reset code button. And so what you often find when you
get this is like I give you some code that is sort of partially there,
in this particular one it has a mistake. And so I’m going to run it,
say check code, and this actually submits the code
to Python and it’ll run. And in this case, it’s got an error, name error print cue is
not defined on line two. And, of course, the bug here is, it
says please correct your code and rerun, the bug here is that’s supposed
to be a t not a q, see, that’s just powerful, so
this first program is really quite easy. And so, it also shows you in
the autograder the desired output. And so we’ll do check code,
and this is going to work. And you see this little spinner, that is
the autograder sending your grade back to Coursera, so that it gets
back in your Coursera gradebook. And if you don’t see that, then you got
a problem, or you can go back and check it in Coursera, but that is the moment where
it’s decided that you’ve done a good job. Now, one thing about this is that once
your grade has been set in Coursera, you can play around here, mess around, and
it doesn’t like send back bad grades, it only sends back good grades. These are all pass/fail, so
you either have a 100% or 0%, and if you later mess it up,
you still keep a 100% for your grade. So it’s not like the last grade that
you sent, it’s actually the high grade, which is really it’s pass/fail,
so it’s 0% or 100%. But the other thing that you’ll notice
is if I make a mistake in the output it’s not going to update the grade,
and so I’m going to make it so the desired output is hello world. And so, if I check the code now, it’s going to say,
please correct your code and re-run. It points over here in a mismatch, because
this is the output of your program, this is the output it wanted
to have happen, okay? And so, that’s what happens, right? Now, the other thing that you will notice,
and I can’t really demonstrate it on this first one, is there is a bit of
static analysis that this autograder does to your code, and it’s like you should
have used a for statement in this problem, or you should have used the input
statement in this problem, etc, etc, etc. And so,
that also can catch you if you sort of, are supposed to compute something but
you just print out the answer. And so it’s not just enough to match the
output, you have to match the output, and it does a little bit of looking at your
Python code to make sure your Python code makes some sense. Another thing that’s cool about this is
this view grades button that you don’t see that we the teaching assistants and
teaching staff see. If you’re having problems on
an assignment, you don’t have to put your code in the forum, you can simply talk
to a teaching assistant in the forum and they can come into the assignment and they
can actually see your exact code sitting in the autograder,
they can even run your code. And so it’s a much better way to exchange
code with the teaching assistants than sort of posting code in the forums. In the very last course we do
let you post code in the forums, but in the first four we don’t. I know that’s frustrating to people, but
working code makes it too easy for people to just like cut and paste it because we’d
like, let me just finish this assignment. And if you don’t struggle on the first
few assignments and understand them, then you won’t actually understand
the fifth or sixth assignment. And so, taking a shortcut by borrowing
code from someone else is really just cheating yourself. And if you put bad code in the forum,
that’s even worse. You say, my code is broken and
it doesn’t work, and then students are like, well,
I’ll just take your broken code. And so, we just don’t like
putting code in the forum. And so, that’s basically the idea,
let me finish this and get it back correct again, so
I print out the right output. So it runs it, you can have
a syntax error, which I showed you. You can have an output error. But if the syntax is right and
the output is right and you’ve passed all the static checks, then
it sends the grade back to Coursera and your grade is updated on Coursera,
then you just click to done button when you’re all done,
then you’re back in Coursera. So, I hope that was helpful to
help get you through writing your first assignment for this class.

Assignment: Write Hello World

Code

Bonus: Chapter 1


Video: Interview: Daphne Koller – Building Coursera

Summary of Interview on Coursera’s Origins and Mission:

Key Figures:

  • Daphne Koller (Stanford professor, co-founder of Coursera)
  • Andrew Ng (Stanford professor, co-founder of Coursera)
  • John Bravman (Stanford Vice Provost for undergraduate education)
  • John Hennessy (Stanford President)

Early Inspiration:

  • Desire to improve Stanford’s undergraduate curriculum and increase faculty-student engagement.
  • Koller’s independent project on video lectures inspired by YouTube.
  • Ng’s project on developing online teaching methods.

Pilot Program and Course Launch:

  • Coursera concept tested in Koller’s class with video lectures and interactive assessments.
  • Stanford opened three large online courses (machine learning, database, AI) in Fall 2011.
  • Unexpectedly high enrollment (100,000+ each) sparked the need for broader platform development.

Transition to Coursera Platform:

  • Stanford spun out Coursera to offer high-quality online education from top universities globally.
  • Built robust platform from scratch to handle large student numbers and graded assessments.

Platform Features:

  • Interaction with material:
    • Active exercises with autograded assessments for deeper learning.
    • Variety of graded formats: multiple choice, numerical answers, math, programming, etc.
  • Social interaction:
    • Peer-grading system for critical thinking assignments.
    • Q&A forums for student-driven knowledge sharing (median response time: 22 minutes!).
    • Organic growth of online and offline study groups based on geography, language, or interest.

Future Vision:

  • Democratize education through global accessibility via internet and mobile devices.
  • Enable lifelong learning across diverse topics and interests, taught by leading experts.

Overall:

The interview portrays Coursera’s journey from an experimental Stanford project to a global education platform driven by a mission to provide accessible, high-quality learning opportunities for anyone, anywhere.

[MUSIC] Our company’s mission is to
educate the world. We believe that education is the great equalizer and that many of
the world’s problems could be made a lot better if more people
had access to education, and that includes problems like unemployment,
like hunger, even extremism, and if you educate
people you open doors for them, to make life better for themselves, for their families,
and for the communities. For me this project started about four
years ago when a group of us who had been award-winning faculty were
invited by John Bravman who was then the Vice Provost for undergraduate
education at Stanford and he invited us to talk about how to open up more room in the curriculum for a meaningful engagement
between faculty and students. And there were a bunch of us in the room
and ideas were thrown around. Nothing particularly gelled. And then two months later I
happened to be at a Google Faculty Summit, listening
to a talk about YouTube. And all of a sudden it came to me that
instead of lecturing in the classroom, the same lecture that I’d been
giving for fifteen years, telling the same jokes
at the same time, maybe we could take that, and preserve it,
and in fact make it available to students in a much more engaging format that has more interaction than you get
in a classroom. So I went to, back to John Bravman and he
got very enthusiastic and he took me to see President John Hennessey
of Stanford, who also was very excited and in fact supported this project with a
generous seed grant in order to try and build up the technology as well as
the pedagogy for making this happen. And so we piloted this in my class
and developed some of the ideas that ended up making their way into
Coursera, including the short video chunks, the integration of
assessments into the video stream, the significant
number of autograded assessments that
allow the students to test their knowledge of the material. And, and so that was part of the project. And then in parallel to that,
my colleague and co-founder Andrew Ng was actually working on a
different trajectory, which is let’s teach the world, and ended up
developing pieces of the design and technology and pedagogy independently
in the context of this other project. And at some point we realized that the
projects were remarkably well aligned because the same ideas, the same
designs, the same contents could be used for both improving the quality of
the instruction for our on-campus students and for offering a meaningful course experience
for the world. And so that realization culminated
in the fall of 2011 with the three large Stanford classes that Stanford opened to the world,
the machine learning class, the database class, and the AI class. And each of those classes
had an enrollment of 100,000 students or more,
which was just a completely mind-blowing
experience because no one expected that to have this
level of uptake. And so in the fall, after we
saw that this was happening, we realized that we
needed to do something with this. We needed to build up on this success and do something even bigger
and more impactful. And it seemed clear that in
order to let this have as, the largest impact that
it could possibly have in terms of teaching all these people
around the world who would never have access to this
kind of high-quality education, we needed to make this available not just
to Stanford, but to a number of top institutions who could offer their
great content to all of these people. And so that’s when we decided to
spin this out of Stanford and make this, build up this platform that
would provide this great experience for students as well as a good
experience for faculty to effectively offer these large online
classes that they could open to the world. >> But were you preparing for the fall of 2011 for like a year, or,
or did you just? >> No. It was kind of of a bit of a
last-minute decision to try out these classes
in this format. And I don’t think anyone anticipated the
extent to which this would take off and have this huge impact, and
uptake in the world. >> So, really you kind of were laying down
a lot of the early code in the fall. >> Yeah. >> [LAUGH] >> So, what happened was in
I think August is when the decision was made, and we
realized that the platforms that we had been using inside Stanford
were just not up to the task of being available, robustly, to
hundreds of thousands of students. Or even tens of thousands, which is what we
thought we would have at that point. And so we started to build up
a platform from scratch using a group of graduate students and
three undergraduates, just unbelievably talented individuals, who ended up also
being the core group that would form the engineering team of
Coursera down the line. One of the things that we tried to build into this project from the
very beginning are opportunities for interaction of the students
with the material, as well as interaction of the students
with their peers. And there’s different ways
in which that happens. In terms of interaction with
the material, we do a lot of active exercises where
the system basically checks the student’s work so that the
student is told whether he or she are actually getting the
material or not. And it’s important that those
tests, those, those assessments, if you will,
are deep and meaningful. And on the other hand, they also need to
be graded at scale, because when you have a hundred thousand students
you can’t have a TA or an instructor in the loop
manually checking papers. And so we have all sorts of different
things that we can check at scale. You know, multiple choice is the obvious one, but one can also check
numerical answers. One can check, check math. One can autograde programming
assignments, and by programming assignments that just don’t mean
just code for computer sciences. An Excel spreadsheet is a programming
assignment in effect too, and you can now grade a financial model or a
marketing model as well. But none of those are the kinds of
solutions that would allow us to support all of the classes that we would like, specifically when you want
classes that require something that’s more critical
thinking where a student would need to write down
some argument for one thing versus another
or discuss the arguments or the causal chain
behind some historical event, or do a, a detailed analysis of a
legal case or something. You cannot do that using
autograding right now. Maybe if, maybe down the line, artificial
intelligence will solve that problem for us, but I’m not counting on it
in the near future. And so how do you do that? And that’s where, again, the social
component of the platform, which is the other big piece of it,
has come to our help because we ended up putting
in place a peer-grading pipeline where students can robustly and
reproducibly grade each other’s work. And it turns out that not only that
is an effective way of grading at scale, it’s also a valuable learning experience for the students,
and studies have not, not by us, but by educational
researchers, have shown that peer rating teaches the students
something, as well as provides a scalable solution
to grading. One of the things that we try
to build in is an opportunity for students to interact
with each other in meaningful ways. And have one student help each other
through the hard bits and have the students work together to achieve
a better outcome for everyone. And so, for example, we had a question
and answer forum where students really were the primary ones responsible for answering
each other’s questions. And there was a real community built up around that where students felt
incredibly motivated to help each other and answer
each other’s questions to the point that in the fall quarter of 2011, the median response time
for a question posted on the forum was 22 minutes, which is not a level of service that I, as an instructor, have ever
offered my students. But because there was such a broad worldwide community of students
all working together, there was, even if you were
doing something at 3 o’clock in the morning,
chances are that somewhere around the world,
there would be somebody who was awake and thinking about
the same problem. And so that social community was really an essential part, I think, of
the student’s experience. And critical to the engagement
and retention of students in the, in the course. >> I just imagine these people
living in Zurich getting together in a coffee shop and as a study group. So what, what were some of your
experiences, or others’ experiences
on study groups? >> So it turned out that study groups
were something that we hadn’t built into the platform originally,
it’s something that we will do soon. But it grew organically. So people
basically, without even being suggested to do that, ended up constructing
study groups on the Q&A forums. So they said that, we have a study group
in London, who wants to join us? We have an, a, a study group of, of Arab
speakers or Hispanics or different types of groupings depending on, you know, geography or language or, or
sometimes other things. We have, in one class, a global study group, which is specifically
people who are looking to connect to people who are not part
of their local culture and geography. And so this was really a fun thing for the
students and some of them met physically, those that had geographical proximity, and
others just communicated in the virtual space, but this organic growth
was just such a powerful thing for students that we really quickly
realized that we needed to build this into the platform. >> You probably are so busy that
you don’t have any time to think too far in the future, but
I’m going to just sort of see. Where, what’s your dream? >> Our dream is that anyone
around the world will have an Internet connection, maybe via
mobile device, which seems to be the way to go in most developing
countries right now because of the way the infrastructure is
developed, or not developed until now. And that people will be able to
learn the things that they care about. And
some of these will be things that are pragmatic
and will help them get a better job and make
more money so they can support their families.
And some of them will be just ways to expand one’s
understanding and one’s imagination by learning amazing things that
you didn’t know about because I think it’s unfortunate
that for most of us learning ends when we finish high school
or when we finish college and that’s the last time we learn anything. And
wouldn’t it be really cool if we had access to a life-long learning experience
that, where you could come and say, I think this is a really cool topic
and I’d like to learn more about that. And you would have access to a really
amazing course taught by the top scholar in
his or her field that could teach that. [MUSIC]

Video: Face-to-Face Office Hours: Milan, Italy

  • The content on this page is a video lecture.
  • The video lecture features Dr. Chuck, the instructor of the course, talking about programming and Python.
  • Dr. Chuck compares writing an operating system to thinking like a computer scientist, while writing a Python program is more like looking through a mailing list or analyzing forum posts.
  • The video also includes introductions from students attending an office hour session in Milan, Italy.
  • The students express their enthusiasm for the course and their excitement about learning programming.
  • The video ends with a group picture and a round of applause for Mauro, the community teaching assistant.

[MUSIC] When I’m writing an operating system,
I’m saying, oh here’s this problem I’ve gotta solve, and here’s these
specifications in performance. I’m thinking like a computer scientist. But when I’m writing a Python program, it’s like looking through a mailing list
for certain kind of mail messages, and then matching those mailing
message up with something else. Or it’s seeing who the most
prolific poster in your forum is. What you are really doing is,
you are slowly but surely putting yourself into that program. We’re in Milan, Italy with one of
the largest office hours ever. And I’d like to do our
standard introduction so that you can see everybody. So give us your name and say hi,
or say something about the course. >> [CROSSTALK] Hi, Malcolm,
I just really like the course. I don’t have anything to say. >> Okay. >> I am Luca, and I am here for [INAUDIBLE] sometimes. >> Okay. >> Hi, I’m Evar. I like the teacher and
I really love the course. >> Great, thank you. >> Hi, I’m Sebastian, and
I attended the Internet History course. >> Great. >> Hi, this is Anarita, learning Python
and getting excited about the course. >> Yeah. >> Ciao, I’m Barbara,
and I like your course. Thank you, Dr. Chuck. >> Thank you, Barbara. >> [LAUGH]

Hi, I’m Alberto. I just want to learn programming. >> Okay. >> Hi, I’m Andrea,
I took Internet History. And when I read that Dr. Chuck was coming,
I started screaming, oh, Dr. Chuck is coming, in the office. >> [LAUGH]
No one understood, but anyway. >> Okay.
Hi, I’m David,
it’s my first course on Coursera. And I wish everybody good luck,
and stay focused on your goals. >> And now we meet the famous
community teaching assistant Mauro. Yay!
[APPLAUSE] >> Yeah! So Mauro, say hi,
whatever you want to say. >> Oh, and yes,
we finally succeed in bringing Dr. Chuck here in Italy and
we have a very big, oh! >> [LAUGH]
[CROSSTALK] We have a very big group [INAUDIBLE]. >> So after that brief interruption
by the construction crew, we’ll go back to talking to Mauro,
our intrepid community teaching assistant. >> I am out here. Finally, we succeed in bringing Dr.
Chuck in Italy. Very successful Office Hour here. A lot of people are both from Programming
for Everybody and Internet History. I am very happy,
very happy about our people. Thank you. >> Okay, so we missed one person. Do you want to say hi? >> [INAUDIBLE] Hi, my name is Zura and I am-
She is my wife. [CROSSTALK] She didn’t take any courses. >> You didn’t take any courses, okay. But you will.
I will, yes. >> Of course you will. >> [LAUGH]
You have to. Okay so, let’s see. Now, let me get a nice group picture. And let’s give Mauro a nice round
of applause, thanking him for how awesome he is for doing what he does. >> Thank you, Mauro! >> [APPLAUSE] >> [MUSIC]