Lesson 1 of 60
Nextโฏ

PY-101 ยท Getting started with Python

What is Python?

โฑ 9 min ๐Ÿ Real Python 3 ๐ŸŽฌ Animated

1of 60

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    โšก 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.

    What is Python?, running
    1. print("Hello from Python!")
    2. print(2 + 3)
    3. print("Python" * 3)
    Press โ–ถ to watch Python run this, one line at a time.
    1. 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.
    2. The Python ideaprint("text to show")Python is a general-purpose programming language that reads almost like plain English.
    3. 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.

    AreaWhat Python does therePopular libraries
    AI and machine learningTrain and call modelsPyTorch, scikit-learn
    Data analysisClean and summarise datapandas, NumPy
    AutomationRename files, call APIs, send reportsrequests, pathlib
    Web back endsServe APIs and websitesFastAPI, Django
    GamesBuild 2D gamespygame

    Syntax

    print("text to show")

    โ–ถ Run the example ๐ŸŽฌ Watch it come alive

    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.

    Ready for more?The full lesson adds the technical explanation, interview questions and quick revision.

    Test yourself

    5 questions. Get 4 right and this lesson is marked complete.

    1. 1. What kind of language is Python?
    2. 2. Who created Python?
    3. 3. What does print(2 + 3) show?
    4. 4. Which file extension do Python programs use?
    5. 5. How does Python mark a block of code, such as the body of a loop?

    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