Introduction to Python
What is Python, why learn it, and writing your first program
What is Python?
Python is a high-level, interpreted programming language created by Guido van Rossum in 1991. It's designed to be easy to read and write, making it one of the best languages for beginners.
Why Learn Python?
- Readable syntax — Python code reads like English
- Versatile — Used for web development, data science, AI, automation, and more
- Huge community — Millions of developers, thousands of libraries
- In-demand skill — Python is one of the most popular programming languages in the world
Your First Python Program
The print() function displays output to the screen. Let's try it:
Hello, World!
How It Works
print() is a built-in function. The text inside the quotes "..." is called a string — a sequence of characters. Python executes code line by line, from top to bottom.
Try changing the text inside the quotes and running it again!
Basic Arithmetic
Python can work as a calculator:
Simple Math
Comments
Comments are notes for humans — Python ignores them. Use # for single-line comments:
Using Comments
Check Your Understanding
What function do you use to display output in Python?
Check Your Understanding
What symbol is used for single-line comments in Python?
Key Takeaways
- Python runs code line by line from top to bottom
print()displays output- Python can do arithmetic:
+,-,*,/,**(power) - Comments start with
#and are ignored by Python
Exercise
Write a program that prints your name and then prints the result of 7 multiplied by 8.