Click “Download PDF”, then choose “Save as PDF” as the printer.
Quick revision notes
Python Programming for Beginners
Getting started
Lesson 1Why Python? The question behind programming
- A program is a precise list of instructions; a programming language lets people write them in a readable form.
- Python was created by Guido van Rossum and first released in 1991; this course uses Python 3.
- Python is readable, comes with a large standard library and runs on Windows, macOS and Linux.
- The interpreter runs your code directly; Python is slower than C or Java but much quicker to write.
- Python is used in data analysis, machine learning, web development, automation and teaching.
Lesson 2Setting up and writing your first programs
- Install Python 3 from python.org and check it with python –version (python3 on macOS and Linux).
- IDLE is the simplest editor to start with; VS Code with the Python extension suits bigger programs.
- print() displays values, and sep and end control spacing and line endings.
- input() shows a prompt and returns what the user typed, always as a string.
- Comments start with # and are ignored by Python.
The building blocks
Lesson 3Variables, data types, operators and f-strings
- A variable is a name for a value; = stores a value, it does not test equality.
- The basic types are int, float, str and bool, and type() shows the type of any value.
- / always gives a float, // divides and rounds down, and % gives the remainder.
- input() returns text, so convert it with int() or float() before calculating.
- f-strings insert values into text, and formats such as .2f control decimal places.
Lesson 4Making decisions and repeating work
- if, elif and else choose between blocks, and only the first true branch runs.
- Use == to compare and = to store; indentation after a colon is part of Python’s grammar.
- for loops walk through a sequence; range(a, b) stops just before b.
- while loops repeat while a condition is True, so make sure it eventually becomes False.
- break leaves a loop early, and continue jumps to the next pass.
Lesson 5Lists, tuples, dictionaries and sets
- Lists are ordered and changeable; indexes start at 0, and -1 means the last item.
- Tuples are like lists but cannot be changed, and they can be unpacked into variables.
- Dictionaries map unique keys to values; get() avoids errors for missing keys.
- Sets hold unique items and support union, intersection and difference.
- Assigning a list to a new name does not copy it; use copy().
Writing real programs
Lesson 6Functions and modules
- def creates a function; parameters receive values and return sends a result back.
- Defining a function does not run it; calling it with arguments does.
- Default values make parameters optional, and keyword arguments can be given in any order.
- Variables created inside a function are local to that function.
- import loads modules from the standard library, from your own files or from packages installed with pip.
Lesson 7Files and exceptions
- open() with mode “r”, “w” or “a” reads, overwrites or appends, and with closes the file for you.
- Use encoding=”utf-8” so that symbols such as ₹ are stored correctly.
- An exception is a run-time error; try and except catch it so the program can respond.
- finally always runs, and else runs only when there was no error.
- Catch specific exceptions instead of using a bare except.
Lesson 8Classes, a mini project and next steps
- A class is a blueprint; objects are instances, each with its own data.
- The constructor stores the starting data, and self refers to the current object.
- Methods are functions inside a class, called with a dot.
- Real programs combine collections, loops, functions and classes, as the marks report does.
- Keep improving by practising daily and building small projects of your own.
Important terms
A huge ecosystem · accumulator · Batteries included · break · call · choose · class · comment · comparison operators · condition · control flow · editor · elif · else · end · exceptions · f-strings · file · float( · for · free and open source · function · Guido van Rossum · high-level language · IDLE · indentation · input( · int( · interpreter · len(marks · list · Little ceremony · machine code · method · Missing quotes or brackets · module · operators · print( · program · programming language · prompt · Python 3 · Python interpreter · python.org · range( · Readable code · released the first version in 1991 · repeat · Runs everywhere · sep · shell · str( · string · sum( · type( · types · variables · VS Code · while · Wrong capital letters
© 2026 VJ Classes · vjclasses.in