Python (Fall 2026) Module 2-2: Procedural Programming and Variables
Overview
Bill Moseley, Ph.D., introduces procedural programming as code that runs one line at a time until it reaches the end or a control structure changes the order. He demonstrates `print("hello world")` in online-python.com, explains strings as sequences of characters, and teaches Python variables, naming rules, and case sensitivity using `name` and `Name` as separate variables.
Key takeaways
- A procedural Python program executes one statement at a time in source order and stops when it reaches the end unless control structures redirect execution.
- The text in `print("hello world")` is a string represented as a sequence of characters, not as words or punctuation understood by the computer.
- Python variables are named containers whose values can be reassigned, such as changing `x` from 5 to 7.
- Valid variable names start with a letter or underscore and contain only letters, digits, and underscores; names cannot begin with a digit.
- Python treats capitalization as significant, so `name = "Bill"` and `Name = "William"` create two distinct variables.
- Printing a variable displays its stored value in a text-based output area, such as the one provided by online-python.com.
Chapters
- Procedural programs run statements from the first line downward, stopping at the end unless control structures alter the sequence.
- In `print("hello world")`, `print` and its parentheses form the function call, while the quoted text is a string of characters.
- Running the example in online-python.com displays `hello world` and a process exit code of zero.
- A variable is a named container, and the data inside it is its value; for example, `x = 5` gives `x` the value 5.
- Reassigning `x = 7` changes its value from that point onward in the program.
- Meaningful names help readers understand code, unlike a vague name such as `x`.
- Variable names must start with a letter or underscore, and can contain letters, digits, and underscores; they cannot start with a digit.
- Python names are case-sensitive: `name` and `Name` refer to different variables, as shown by assigning them `"Bill"` and `"William"`.
- Names such as `print` conflict with existing Python functions, so check for reserved or already-used names when assignments cause trouble.
- Use `print` to inspect a variable's value; online-python.com shows the result in its text-based program output.
Transcript excerpt
0:02 So we're going to start out with a type of programming, and we're going to explore a few different types of programming, or models of programming, in this class, but we're going to start out with the most basic kind, and it's called procedural programming. What I mean by procedural programming is this. When I write a procedural program, it starts on the first line of my code and it runs that line of code. Then it goes to the next line of code, runs that line of code, and so on. It just goes down the page unless I tell it to do something else or go in a different order, which I can do it using what are called control structures. We'll learn about those very soon. My programs are just going to run one line at a time. And so that is what procedural programs do. And when it gets to the end of the program, it stops. So in our code,
0:58 we talked about this, print hello world, we've got multiple things going on here, right? If I add a little color here, we can see them more easily. But the teal part of that, the print, the word print and the parentheses, are part of the print function. Maybe you remember that from last time. And in the red, the part in the quotation marks, we have a string. A string is a type of data that says it includes this list of characters. Now, this is not two words and punctuation. This is a list of characters: a lowercase h, a lowercase e, and so on. That's how the computer sees it. The computer doesn't understand hello or world or what an exclamation point means. It just has characters.
1:55 So, let's jump into online Python. If you type online-python.com,
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Bill Moseley, Ph.D. - Computer Science Educator.