Introduction to Programming, CS 101 Lecture 2 – Study Notes
offline

Difficulty: Beginner | Prerequisites: Lecture 1 (What Is Computer Science)

This lecture introduces programming itself: what it means, which languages exist, and why this course uses Python. It also covers the first building block of any program, the variable. If you are comfortable with what computer science is and why binary matters (Lecture 1), you are ready for this.


TL;DR

Programming is writing instructions for a computer in a language it can process. Python is the language used in this course because it is beginner-friendly and widely used in industry. A variable is a named container that stores data for your program to work with.


Key Terms and Definitions

Programming

Writing instructions for a computer using a programming language.

In simple terms, programming is telling a computer what to do, step by step, in a language it understands.

Programming language

A formal language with its own rules (syntax) that humans use to communicate instructions to a computer.

Think of it as a foreign language, except the listener is a machine.

Python

A high-level, general-purpose programming language known for its readable syntax and broad use in AI, data science, web development, and automation.

In simple terms, Python is the language this course teaches because it reads almost like English and is forgiving of beginners.

Java

A widely used, object-oriented programming language common in enterprise software and Android development.

C++

A powerful language used in systems programming, game development, and performance-critical applications.

JavaScript

The language of the web browser. Used to make websites interactive.

Variable

A named container that stores a value in a program. The value can change as the program runs.

Think of it as a labelled box: you put something in, and later you can look inside the box or swap its contents.

Syntax

The set of rules that defines how a programming language must be written. Violating syntax rules causes errors.

In simple terms, syntax is grammar for code.


Core Content

What Is Programming?

Programming is the act of writing instructions that a computer can execute. Those instructions are written in a programming language, which has strict syntax rules. If the syntax is wrong, the program will not run.

Common Programming Languages

Four languages are highlighted in this lecture:

  • Python – beginner-friendly, readable syntax, dominant in AI and data science

  • Java – widely used in enterprise and Android apps, strongly typed

  • C++ – high performance, used in games and systems programming

  • JavaScript – runs in web browsers, makes websites interactive

Each language has trade-offs. Python prioritises readability; C++ prioritises speed; JavaScript is tied to the web.

Why Python?

This course uses Python for three reasons:

  • It is beginner-friendly, with syntax that reads close to plain English

  • It has a gentle learning curve, so students can focus on concepts rather than wrestling with the language

  • It is widely used in industry, particularly in AI, data science, and automation, so the skills transfer directly to real work

Variables

A variable stores information that a program can use and change. You create a variable by giving it a name and assigning it a value.

In Python, this looks like:

name = "Alice"

age = 20

The variable name holds the text "Alice". The variable age holds the number 20. You can update a variable later in the program, and the old value is replaced.


Real-World Applications

Python is used at companies like Google, Netflix, and Instagram. Data scientists use it to analyse datasets and build machine learning models. Automation scripts written in Python save hours of repetitive work in offices and labs worldwide. If you learn Python well in this course, you are learning a tool with immediate professional value.


Common Misconceptions

  • Students often think you need to be good at maths to learn programming. Introductory programming is closer to learning a new language than doing calculus.

  • Some students assume Python is a "toy" language because it is easy to learn. Python powers production systems at some of the largest tech companies in the world.

  • A common early mistake is confusing the name of a variable with its value. The variable age is not the number 20; it is a label that currently points to 20, and could point to something else later.

  • Students sometimes think all programming languages do the same things equally well. Each language has strengths and trade-offs suited to different tasks.


Why It Matters / Exam Flags

⚠️ Be able to define programming in one sentence.

⚠️ Know the four common languages mentioned (Python, Java, C++, JavaScript) and one distinguishing feature of each.

⚠️ Be able to explain why Python was chosen for this course (at least two reasons).

⚠️ Understand what a variable is and be able to write a simple Python assignment statement.

⚠️ Know the difference between a variable name and its value.


Quick Self-Test

  1. True or false: Programming means writing instructions in a language the computer can process.

  1. Fill in the blank: Python is popular for ________ and data science.

  1. True or false: JavaScript is primarily used for systems programming.

  1. Fill in the blank: A ________ is a named container that stores a value in a program.

  1. True or false: In Python, x = 10 creates a variable called x with the value 10.


Practice Q&A

Q: What is programming?

A: Programming is writing instructions for a computer using a programming language.

Q: Name four common programming languages.

A: Python, Java, C++, JavaScript.

Q: Give two reasons this course uses Python.

A: Python is beginner-friendly with easy-to-read syntax, and it is widely used in AI and data science.

Q: What is a variable?

A: A named container that stores a value. The value can change as the program runs.

Q: Write a Python statement that creates a variable called city and sets it to "Austin".

A: city = "Austin"

Q: What happens if you write age = 25 and later write age = 30?

A: The variable age now holds 30. The old value (25) is replaced.


Connections to Other Topics

Variables connect directly to data types (likely covered in the next lecture), where you will learn that a variable's value has a type (integer, string, boolean) and that the type affects what operations you can perform. Understanding variables is also the foundation for control flow (if/else), loops, and functions, which are the core building blocks of any program.


Related Terms / Search Tags

programming definition, what is programming, intro to programming, CS 101 programming, Python beginner, why Python, Python vs Java, Python vs C++, JavaScript, variable in Python, what is a variable, assignment statement, syntax, programming language, coding basics, CS fundamentals, learn to code