Level: Beginner | Prerequisites: None
Learning Goals
- Can explain the difference between a programming language and an interpreter
- Install the Python development environment (Python + VS Code) by yourself
- Write and run your first Python program
- Understand the difference between REPL and scripts
- Add explanations to code using comments
1. What is Python
Python is an interpreted language released in 1991 by Guido van Rossum. It is designed with readable syntax, making it one of the best languages for beginners to learn first.
Areas of use:
- Web development (Django, FastAPI)
- Data analysis and machine learning (Pandas, PyTorch)
- Automation and scripting
- Games, embedded systems, education, etc.
Compiled vs Interpreted: Python executes code line by line immediately. Therefore, it is strong for rapid prototyping, but the execution speed is slower compared to languages that are compiled in advance.
2. Setting Up the Development Environment
Installing Python
- Official site: https://www.python.org/downloads/
- Version: 3.10 or higher recommended
- Windows: Be sure to check "Add Python to PATH" when installing
- macOS:
brew install pythonis also possible
Verifying the Installation
In the terminal (or command prompt):
python --version # Python 3.x.x
python3 --version #macOS/Linux usually python3
Installing VS Code
- https://code.visualstudio.com/
- Install "Python" (Microsoft) from Extensions
3. First Program — Hello, World!
REPL (Interactive Mode)
Type pythonZX in the terminal → >>> prompt appears → Enter one line at a time and see the result immediately.
>>> print("Hello, Python!")
Hello, Python!
>>> exit()
Script Mode
Save code in a file and run it. This is the basis of actual development.
#After creating a file called hello.py
python hello.py
→ See examples/01_hello.py.
4. Comments
Start with # to comment to the end of the line. The computer ignores it; only humans read it.
#// Single line comment
print("Executed") #// Can also be at the end of the line
Multi-line comments can also be represented with """...""", but strictly speaking, these are strings.
Key Examples (examples/)
| File | Content |
|---|---|
01_hello.py |
First output using print() |
02_multiple_print.py |
Multi-line output |
03_comments.py |
How to use comments |
⚠️ Common Mistakes
-
pythoncommand does not work in the terminal → PATH not registered in Windows. Run the installer again and check "Add Python to PATH". -
"SyntaxError: Missing parentheses in call to 'print'" → Using Python 2 syntax (
print "hello"). Python 3 requires parentheses (print("hello")). -
Korean characters are garbled → When saving a file, if the encoding is not UTF-8. Check the encoding display at the bottom right of VS Code.
-
Forgot to include quotation marks like
print(Hello)→NameError: name 'Hello' is not defined. Strings must always be enclosed with"..."or'...'.
❓ Frequently Asked Questions (FAQ)
Q1. What is the difference between python and python3?
A. Often, you need to specify python3 because system Python 2 comes installed with In-macOS/Linux. On Windows, usually python alone works. Try both.
Q2. Can I use editors other than VS Code? A. Yes. PyCharm, Sublime Text, and Notepad are also possible. However, environments without autocomplete or debugging decrease learning efficiency.
Q3. Should I use REPL or scripts? A. Short experiments or checks use REPL, actual programs use scripts. Both are frequently used in class.
Q4. Is there any other way to output besides print?
A. There are lower-level functions like sys.stdout.write(), but for beginners, print() alone is sufficient.
📝 Exercises (exercises/)
exercise1.md— Environment setup verificationexercise2.md— Print self-introduction usingintro.pyexercise3.md— Self-introduction card (at least 5print)
Answers (solutions/)
First, try to solve it yourself and refer to solutions/ only when stuck.
Next Week
Week 2. Variables and Data Types — How to handle data by storing it in variables