Learn Python from scratch: your first 15 minutes
By Live Code Tutor team · · 5 min read
Start with one tiny program. Predict what it will do, run it, change one thing, and explain the result. You can do your first session in a browser without installing Python.
Write something you can see
A program is a set of instructions. Python follows those instructions in order. Start by asking it to show some text:
print("Hello, World!")
The text inside the quotes is a string. print displays it. Before running the code, say what you expect to see. Then press Run and compare the output with your prediction.
Now replace the text with your own greeting. Run it again. You have changed a program and checked the result. That is already useful practice; you do not need to memorise a list of commands first.
Give a value a name
A variable is a name that refers to a value. Try this:
name = "Sam"
print("Hello,", name)
The first line gives the text "Sam" the name name. The second line prints the greeting and the value. Change Sam to another name, predict the output, and run again.
Notice that name has no quotes in the second line. print("name") prints the literal word name. print(name) prints the value referred to by the variable. Small comparisons like this help a new idea make sense.
A simple 15-minute session
Use your time for a small cycle:
- Three minutes: read one explanation and predict an example.
- Seven minutes: write and run a tiny program. Change an input and try again.
- Three minutes: check the task with tests and read any feedback.
- Two minutes: write one sentence about what you learned.
For a first task, set a variable called greeting to "Hello, World!", then print it. Run shows what happens. Run tests checks whether the value matches the task. A successful run does not automatically mean the task is solved.
If a test fails, compare the expected result with yours. Check spelling, punctuation, and the variable name before making a larger change.
Read an error as a clue
An error does not mean you cannot code. It tells you that Python could not follow an instruction. Start with the last line of the error message. Then look at the line number and compare the code with the task.
Common early mistakes include a missing closing quote, a missing bracket, and a name that differs by one letter. Python treats Name and name as different names.
Change one thing at a time. If you change several things together, you lose the chance to learn which change helped. If you remain stuck, ask for a hint about what to check next.
Choose a small next step
After your first program, practise numbers, variables, conditions, and loops. Follow a guided path if choosing topics feels difficult. You can explore web development, data, or interview problems as your foundations grow.
A useful progress question is: Can I write a small example and explain why it works? Completing a video or copying a solution is less useful evidence than an attempt you can explain.
In Live Code Tutor, try Hello, World! without an account. When you want to save progress, create a free account. Choose programming foundations and a short session. Your first activity is ready in the browser. The getting-started guide explains the workspace controls.
Further reading
Make your next step a small one.
Try a Python lesson, then save your progress with a free account.