Basic
Source: 1-Python Basics/1.0-basic.ipynb
Start here — no coding background needed
What you will learn
Run your first Python lines and see instant output — zero experience needed.
In simple words
A program is a list of instructions. Python reads from top to bottom. `print` simply shows text on screen — like sending a message to yourself.
Think of it like this
Like voice notes to a friend: first note says hello, second says your name.
How to use this lesson
- Press Run on the easy example
- Change the text inside quotes
- Run again and watch output change
Words to know:
- print() — Shows text on the screen
- Program — A saved list of instructions for the computer
Start here if you have never coded. We use everyday examples — no jargon without explanation.
Easy example — run this first. Change values and press Run again.
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Reference notes (from full bootcamp)
Optional — deeper detail for when you are ready
Syntax and Semantics in Python
Video Outline:
- Single line Comments and multiline comments
- Definition of Syntax and Semantics
- Basic Syntax Rules in Python
- Understanding Semantics in Python
- Common Syntax Errors and How to Avoid Them
- Practical Code Examples
Syntax refers to the set of rules that defines the combinations of symbols that are considered to be correctly structured programs in a language. In simpler terms, syntax is about the correct arrangement of words and symbols in a code.
Semantics refers to the meaning or the interpretation of the symbols, characters, and commands in a language. It is about what the code is supposed to do when it runs.
Expected (from notebook): Anshul Negi
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Indentation
Indentation in Python is used to define the structure and hierarchy of the code. Unlike many other programming languages that use braces {} to delimit blocks of code, Python uses indentation to determine the grouping of statements. This means that all the statements within a block must be indented at the same level.
Expected (from notebook): 32 32
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): Hello World
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): 43
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): 15
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): int
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): str
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): <class 'int'> <class 'str'>
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): 32
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): Correct Indentation This will print Outside the if block
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Conclusion:
Understanding the syntax and semantics of Python is crucial for writing correct and meaningful programs. Syntax ensures the code is properly structured, while semantics ensures the code behaves as expected. Mastering these concepts will help in writing efficient and error-free Python code.
Practice test — try yourself
Write code, press Check. Wrong answer shows the correct code to copy & run.
Print exactly two lines:
1) Hello, Python!
2) I am learning to code
Hint: Use two print() statements.