Fundamentals

How to Learn Python From Scratch: A Beginner's Roadmap

Start with a small habit: write code, predict its output, run it, then change one thing. Python syntax becomes familiar through repetition, not passive video watching.

Step by step

  1. Install a current supported Python 3 version or use a browser-based learning environment.
  2. Learn variables, conditionals, loops and functions before choosing a specialization.
  3. Practice short programs every day and keep a notebook of errors you have solved.
  4. Build one small project you can explain without copying a tutorial.

Run this example

Use Python 3. Copy the code into a file or interactive Python environment.

name = "Ada"
minutes = 20
print(f"{name} practiced for {minutes} minutes")

Expected output

Ada practiced for 20 minutes

Common issue

If `python` is not recognized, check your installation and try `python3` on systems that use that command.

Try it yourself

Change the name and minutes, then add a second print statement that shows tomorrow's goal.

Build a repeatable practice loop

Save your first program as practice.py in a folder you can find again. Open a terminal in that folder and run python practice.py (or python3 practice.py on systems using that command). The terminal runs a file; the interactive prompt runs one statement at a time. Do not paste terminal commands after the Python >>> prompt.

Start with values and expressions, then learn decisions, repetition, and functions. After each topic, build a small program from a blank file. For example, combine a list of practice sessions with a loop before attempting an API or spreadsheet project. Measure progress by programs you can explain and change.

Track a week of practice

The list holds three sessions. sum adds their durations and len counts sessions. An f-string inserts calculated values into the message.

sessions = [15, 20, 25]
total = sum(sessions)
print(f"Total: {total} minutes")
print(f"Average: {total / len(sessions):.1f} minutes")

Expected output

Total: 60 minutes
Average: 20.0 minutes

Practice and check

Add a 40-minute session. The total should become 100 and the average 25.0. Next set the list to empty: division by zero is a useful signal that you need a condition before calculating an average.

When setup fails

If you see a file-not-found error, check the terminal's working directory and the filename. A file named practice.py.txt is not the intended Python filename. A syntax error usually points to missing punctuation; compare quotes and parentheses before reinstalling Python.

Keep learning

Read the relevant documentation · Free foundational resources

Related guides: How to Build a Python Portfolio With Real Projects and Python Variables and Data Types Explained With Examples.

Interested in applying these skills to a product? Explore the optional Python to Profit course. It focuses on product and business building, not replacing foundational Python study.