Learn Python for Beginners (Start From Zero, Free)
From the guide Code, Build, Create: Learn Python From Zero to Four Real Projects
To learn Python as a beginner, install Python 3 from python.org and a free code editor such as VS Code, then learn the basics in this order: printing and input, variables and types, conditions, loops, lists and dictionaries, and functions. Practice for 30 to 60 minutes most days by typing examples yourself, changing them, and explaining each line in your own words. Within a few weeks, build one small real project, because projects are where the pieces finally click.
Everything below is free to follow, and none of it assumes you have programmed before.
Why Python is a good first programming language
Python reads close to plain English, so you spend your energy on ideas instead of punctuation. A program that greets someone looks like this:
name = input("What is your name? ")
print("Nice to meet you,", name)
It is also genuinely useful. People use Python to automate boring computer tasks, clean up spreadsheets, analyze data, build websites and work with AI tools. That means the skills you learn as a beginner carry straight into real work, and when you get stuck, someone online has almost certainly asked the same question.
You do not need to be good at math. Basic arithmetic covers almost everything a beginner writes. What helps far more is patience with small mistakes.
How to set up Python on your computer
This is where many people quit, and it is almost never about ability. A command says "not recognized," and they decide programming is not for them. It was a setup problem. Go slowly and check each step.
- Download Python 3 only from python.org (or your system's official app store or package manager). Avoid search ads that point to lookalike sites.
- On Windows, tick "Add python.exe to PATH" on the first installer screen. This one checkbox prevents the most common beginner problem.
- Check it worked. Open a terminal (Command Prompt, PowerShell or Terminal) and type
python --version. On a Mac, usepython3 --version. On Windows, ifpythonis not recognized, trypy --version. - Install VS Code from code.visualstudio.com, open it, go to Extensions, and install the Python extension published by Microsoft.
- Make a project folder called
python-learning, open it in VS Code with File, Open Folder, and create a file calledhello.py. - Type, save and run:
print("Python is working.")then click the Run button. If you see the message in the panel at the bottom, you are set up.
Two fixes solve most problems: close every terminal and open a fresh one after installing (old windows do not see the new Python), and in VS Code use the Command Palette (Ctrl + Shift + P, or Command + Shift + P on a Mac) to run "Python: Select Interpreter."
If you are on a locked work laptop or a Chromebook, start in a free online Python editor in your browser. Basics like variables, loops and functions all work there. Move to a real install when you want to work with your own files.
What to learn first: a beginner Python study order
Learn these in order. Each builds on the last.
- Running code. The interactive prompt (the
>>>you get by typingpythonin a terminal) is a scratchpad for trying one line at a time. A.pyfile is a saved program you can run again. If you see>>>, typeexit()before running terminal commands. print()andinput(). Showing output and asking the user questions. Remember thatinput()always returns text, soint(input("Age? "))is needed before you do math with it.- Variables and types. Text (strings), whole numbers (ints), decimals (floats) and True or False (booleans), plus converting between them.
- Conditions.
if,elifandelselet your program make decisions. - Loops.
forandwhilerepeat work so you do not have to. - Lists and dictionaries. Ways to store many values, such as a shopping list or a set of names and phone numbers.
- Functions. Named, reusable chunks of code. This is where your programs start to look organized.
- Errors and files. Reading error messages calmly, handling bad input, and reading or writing files on your computer.
- Installing packages. Using extra tools other people wrote, inside a virtual environment so experiments do not affect your system.
Do not rush through 1 to 7. Most beginners who struggle later skipped practice on loops, lists and functions.
How to practice so it actually sticks
Watching tutorials feels productive but fades fast. Use a simple method on every example: Type, Tweak, Explain.
- Type it yourself instead of copying and pasting. Your fingers learn the patterns.
- Tweak it. Change a number, add a question, break it on purpose and read the error.
- Explain it. Write a short comment above each line in your own words, like
# the commas put spaces in.
Keep a learning log: one line per session with what you did and your next step. Start each session by retyping one example from last time. Short, frequent sessions beat one long weekend binge.
Good first projects once you know the basics:
- A tip or budget calculator
- A number guessing game
- A to-do list that saves to a text file
- A script that sorts the files in your Downloads folder into subfolders by type
- A small program that fetches data from a website
A worked example: Aisha's first month with Python
Aisha works in customer support and wanted to automate a weekly report she built by hand. She had never coded.
Week 1. She installed Python and VS Code. Her first try failed with "python is not recognized," so she reran the installer with the PATH box ticked and opened a new terminal. Then she wrote hello.py and a small trip planner that asked for a city, number of nights and cost per night, and printed the total. Typing four instead of 4 crashed it, which taught her that int() expects digits.
Week 2. She practiced conditions and loops for 40 minutes on weekday evenings. She built a number guessing game and commented every line.
Week 3. Lists, dictionaries and functions. She rewrote the guessing game using a function and added a high score saved in a dictionary.
Week 4. She wrote a script that read a CSV export of support tickets, counted tickets by category with a dictionary, and printed a summary. It replaced about an hour of manual counting every week. The code was not elegant, and that did not matter. It worked, and she understood every line.
Common beginner mistakes in Python
- Tutorial hopping. Starting a new course every time one gets hard. Pick one resource and finish it.
- Copying and pasting code. It works today and teaches you nothing. Type it.
- Typing terminal commands inside the
>>>prompt. If you see>>>, you are inside Python. Exit first. - Capital letters. Python is case sensitive.
Printis an error,printworks. - Unclosed quotes and brackets. When an error points at a line that looks fine, check the line above it.
- Curly quotes pasted from a word processor. Retype them in your editor.
- Forgetting to save before clicking Run, then wondering why nothing changed.
- Fearing error messages. Read the last line first. It names the problem. Searching the exact error text in quotes almost always finds an answer.
Common questions
Can I learn Python for free online?
Yes. Python and VS Code are both free, the official python.org site has a free tutorial, and many reputable sites offer free beginner courses and practice exercises. Free online editors also let you start in a browser with nothing installed.
How long does it take to learn Python as a beginner?
With 30 to 60 minutes of practice most days, many beginners are comfortable with the basics (variables, conditions, loops, lists and functions) within a couple of months, though everyone's pace differs. Being job ready takes longer and depends on the field. Aim for "I can build a small useful script" first.
Is there a Microsoft Learn course for Python beginners?
Yes, Microsoft Learn has free introductory Python material, including beginner modules, and it pairs naturally with VS Code. It works well alongside the study order above. Whichever course you choose, the habit that matters most is typing and changing the code yourself.
Should I learn Python from a book or a PDF?
A book or PDF is good for a clear, ordered path that stops you from tutorial hopping. Videos are good for watching setup steps and debugging in action. Many people do best with one structured written resource plus daily hands-on practice in their own editor.
Keep reading
- Learn French on Your Own: A Practical Self-Study PlanLearn how to assess your style, choose resources, build a routine, track progress, and avoid pitfalls when studying French without a teacher.
- How to Stop Procrastinating: 17 Tips That Actually WorkPractical tips to stop procrastinating: start with five minutes, size work sessions to your attention, remove easy escapes, and build habits that last.
- How to Learn Spanish Quickly for Travel (4-Week Plan)Learn Spanish quickly for travel with the phrases that matter most, a simple 4-week practice plan, free resources and tips for Spain, Mexico and Costa Rica.
- How to Study Effectively (Methods That Actually Stick)How to study effectively: use active recall and spaced review instead of rereading, plan backward from the exam, and keep your phone from breaking focus.
- 15 of the Best AI Image Prompts (and How to Write Your Own)Copy 15 of the best AI image prompts for portraits, scenes and products, and learn the simple six-part formula that makes any image AI listen.
- How to Use ChatGPT for Beginners (Start Here, No Jargon)Set up ChatGPT safely, have your first conversation, and write prompts that get useful answers. Plain steps, a real example, and the mistakes to skip.