Python Programming
Computer ScienceChapter 1 — Introduction to Python
Lesson 1.5 : Python Syntax and Indentation
Reading & Interactive Lesson
Python Syntax and Indentation
Reading Material & Notes
What is Python?
This lesson explains What is Python? as part of Introduction to Python in the Python Programming course. It introduces the core concepts, terminology, workflow, and practical use of the topic.
Python Syntax and Indentation
Python uses a simple and readable syntax. One of its important characteristics is that indentation is used to define blocks of code.
Important Concepts
- Understand the definition and purpose of the topic.
- Learn the important terminology and components.
- Understand the typical workflow or implementation steps.
- Identify practical use cases and common mistakes.
- Practice the concept with a small exercise.
Indentation
Indentation means the spaces at the beginning of a line. Python uses indentation to identify statements belonging to a block.
Example
age = 20 if age >= 18: print("Adult")
The indented print statement belongs to the if block.
Comments
Comments are used to explain code and are ignored during program execution.
# This is a single-line comment name = "Python" # Store language name
Identifiers
Identifiers are names used for variables, functions, classes and other programming elements.
Basic Rules
- Identifiers can contain letters, digits and underscores.
- An identifier cannot start with a digit.
- Python identifiers are case-sensitive.
- Keywords should not be used as identifiers.
Key Points
- Indentation is important in Python.
- Consistent indentation makes programs readable.
- Use practical examples to reinforce the concept.
- Python uses a colon to introduce many code blocks.
Course Curriculum
10 Chapters • 50 Lessons
Chapter 1 — Introduction to Python
5 Lessons
Chapter 2 — Variables, Data Types and Operators
5 Lessons
Chapter 3 — Conditional Statements
5 Lessons
Chapter 4 — Loops and Iteration
5 Lessons
Chapter 5 — Functions and Modules
5 Lessons
Chapter 6 — Lists, Tuples, Sets and Dictionaries
5 Lessons
Chapter 7 — Strings and File Handling
5 Lessons
Chapter 8 — Exception Handling
5 Lessons
Chapter 9 — Object-Oriented Programming
5 Lessons
Chapter 10 — Python Projects and Applications
5 Lessons