PY-101 ยท Getting started with Python
What is Python?
โฑ 9 min ๐ Real Python 3 ๐ฌ Animated โ Completed
โก The 30-second answer
Python is a general-purpose programming language that reads almost like plain English. It is used for AI, data analysis, automation, web back ends and scripting. You write instructions in a .py file and the Python interpreter runs them line by line.
- What Python is and where it is used
- Why Python is the main language of AI work
- How to run your first line of Python
Try it
Watch it come alive, run it yourself, then prove it. Real Python, right on this page.
Watch Python run the example. Every variable is a jar; watch the values change and the output appear.
print("Hello from Python!")print(2 + 3)print("Python" * 3)
Change anything and press Run (or Ctrl+Enter). Then open Watch it and press Watch my code.
Input one line per input() call
Press Run to see the output. Python runs in your browser. Expected output
Hello from Python!
5
PythonPythonPython ๐ฏ Change the program so it prints exactly: I am learning Python
Input one line per input() call
Press Run to see the output. Python runs in your browser. Need a hint?
Put your sentence between the quotes inside print(). Capital letters matter.
- The problemYou ask an AI assistant to rename 300 holiday photos by date. It replies with 12 lines of Python. Do you run it? If you can read Python, you can tell in ten seconds whether it renames your photos or deletes them.
- The Python idea
print("text to show")Python is a general-purpose programming language that reads almost like plain English. - In real lifeA finance team gets 40 Excel files every month and copies totals into one sheet by hand. A 20-line Python script does it in two seconds and never mistypes a number.
Start with a question
You ask an AI assistant to rename 300 holiday photos by date. It replies with 12 lines of Python. Do you run it? If you can read Python, you can tell in ten seconds whether it renames your photos or deletes them.
Most AI libraries, data tools and automation scripts are written in Python. Even if an AI assistant writes the code for you, you need to read Python to check that it does the right thing.
Explain it like I'm 10
A computer does exactly what it is told, nothing more. Python is a way of telling it, using words that look a lot like English. You write the steps, and Python follows them one by one, top to bottom.
The technical explanation
Python was created by Guido van Rossum and first released in 1991. It is interpreted: there is no separate compile step you run by hand. The interpreter reads your program from top to bottom and runs each line.
Python cares about readability. Blocks of code are marked by indentation instead of curly braces, so well-formatted code is the only kind that runs.
The editor on this page runs real Python 3 inside your browser using Pyodide, which is CPython compiled to WebAssembly. Nothing is sent to a server.
| Area | What Python does there | Popular libraries |
|---|---|---|
AI and machine learning | Train and call models | PyTorch, scikit-learn |
Data analysis | Clean and summarise data | pandas, NumPy |
Automation | Rename files, call APIs, send reports | requests, pathlib |
Web back ends | Serve APIs and websites | FastAPI, Django |
Games | Build 2D games | pygame |
Syntax
print("text to show") Real-world scenario
A finance team gets 40 Excel files every month and copies totals into one sheet by hand. A 20-line Python script does it in two seconds and never mistypes a number.
Test yourself
5 questions. Get 4 right and this lesson is marked complete.
Pass the quiz to complete this lesson.
๐ Every lesson counts toward your certificate Next: print() and your first program โQuestions people ask
Is Python good for beginners?
Yes. Python has short, readable syntax, so beginners spend their time on ideas rather than punctuation. It is also used in real jobs, so what you learn first stays useful.
Do I need to install Python to start?
No. Every lesson here runs real Python in your browser. Install Python from python.org later, when you want to build programs on your own computer.
Is Python still worth learning when AI can write code?
Yes. AI tools write a lot of Python, and someone has to read it, test it and fix it. Knowing Python is how you tell good generated code from code that only looks right.
Interview questions
How this topic comes up in Python interviews. Answer out loud first, then open the model answer.
beginner Is Python good for beginners?
Yes. Python has short, readable syntax, so beginners spend their time on ideas rather than punctuation. It is also used in real jobs, so what you learn first stays useful.
beginner Do I need to install Python to start?
No. Every lesson here runs real Python in your browser. Install Python from python.org later, when you want to build programs on your own computer.
beginner Is Python still worth learning when AI can write code?
Yes. AI tools write a lot of Python, and someone has to read it, test it and fix it. Knowing Python is how you tell good generated code from code that only looks right.
intermediate What kind of language is Python?
A general-purpose, interpreted language. Python is general purpose (AI, web, scripts, data) and interpreted: the interpreter runs your code line by line.
intermediate Who created Python?
Guido van Rossum. Guido van Rossum created Python and released it in 1991. Gosling made Java, Stroustrup C++, Eich JavaScript.
Quick revision
Remember
- What Python is and where it is used
- Why Python is the main language of AI work
- How to run your first line of Python
- Python 2 reached end of life in 2020. If a tutorial writes
print "hi"without brackets, it is teaching Python 2: find a newer one.
Syntax
print("text to show") Official documentation
- The Python Tutorial (docs.python.org)
- Whetting your appetite (docs.python.org)