Free course ยท Beginner
Python for Absolute Beginners
What you will learn
- Install Python and run a script on your own machine โ and in a browser when you have to borrow a computer
- Use variables, strings, numbers, lists and dictionaries without looking up the syntax every time
- Make a program decide and repeat with if/else and loops, instead of testing it by hand
- Write your own functions, so a program you already wrote can be reused instead of retyped
- Read and clean a real CSV file, then print a summary an interviewer would accept
- Explain any line of your own code out loud โ the skill technical interviews actually test
Course curriculum
5 modules ยท 15 lessons ยท a worked example and a practice task in every lesson
Module 1Your first program1 of 53 lessons
Week 1 โ install the tools, print something, and understand what a variable is.
Meet your tools
Python is the language; you still need a place to write it and a place to run it. We set up one on your computer and one in the browser, so a shared or college machine is never a blocker.
The lesson
A programming language is not a program. Python is the language; you still need a place to write it and a place to run it. If those two things are not set up, every later lesson turns into a fight with the computer instead of a lesson about code โ which is why this is lesson one and not an appendix.
Install Python 3 from python.org, taking the box that says "Add Python to PATH" โ if you miss it, the command below will not be found and nothing else will work. Then open a terminal (Command Prompt or PowerShell on Windows, Terminal on a Mac) and type
python --version. Seeing a version number means the tool is in place. Write your code in a plain text editor โ VS Code if you can install it โ save the file as hello.py, and run it withpython hello.py. That loop, write then run, is the whole job for the next six weeks.If no computer is available for a few days, use an online Python editor in the browser and keep going โ but plan for a real machine, because the last three modules of this course save and read files. The mistake that stops most people is skipping the awkward setup step, running something once in a browser tab, and never building the habit of running code they wrote themselves.
Example A first session looks like this: type print("Hi, I am learning Python") into a file called hello.py, save it, and run python hello.py in the terminal.
Practice Install Python 3, create hello.py, print your own name and city, and paste the output into your learning notes.
Variables and data types
A variable is a labelled box. name = "Asha", age = 21, height = 5.4, is_student = True โ strings, integers, floats and booleans carry most of what a fresher ever writes.
The lesson
A variable is a labelled box you put a value in.
name = "Asha"stores text under the namename. The four types you will meet in the first month are string (text, in quotes), integer (whole number), float (number with a decimal point) and boolean (True or False). Nothing here is abstract: a resume parser, your marks sheet and an attendance register are all made of these four.The subtlety that matters is that the quote marks change the type.
age = 21is a number you can do arithmetic on;age = "21"is text, andage + 1on it fails.print(type(age))tells you which one you have at any moment โ use it whenever a value misbehaves. Names should say what they hold:student_marksoverm,is_placedoverx.The common mistake is naming a variable something vague and then forgetting what is in it three lines later, and the second is assuming a value taken from anywhere other than your own typing โ a file, a form, an API โ is a number. It is text until you convert it.
name = "Asha" age = 21 height = 5.4 is_student = True print(type(age)) # <class 'int'> age_text = "21" print(type(age_text)) # <class 'str'>Example name = "Asha"; age = 21; print(type(age)) prints <class 'int'>. Change it to age = "21" and the type becomes str โ that difference causes most beginner bugs.
Practice Write five variables about yourself, print each one with its type, then deliberately break one and read the error message before fixing it.
Input, output and f-strings
input() ALWAYS returns text. Converting it to a number is the first real bug every beginner meets, and knowing why it happens is the difference between guessing and debugging.
The lesson
input()asks the person at the keyboard for a value, andprint()shows one back. Notice the word "text": input ALWAYS returns a string, even when the person types 25. That single fact causes most beginner errors, and once you know it, converting withint()orfloat()becomes an automatic step rather than a mystery.An f-string is a string with a value slotted in:
print(f"{name}, you turn {age + 1} in {year}"). Everything inside the braces is evaluated as code, so no messy joining with+and no converting numbers to text by hand. Use f-strings from the start; they are what the industry writes.The mistake to watch for is mixing the two styles,
"Your age is " + age, which fails because a string and a number cannot be joined. If a line gives you "can only concatenate str (not int) to str", that is this bug, and the fix is eitherstr(age)or โ better โ an f-string.name = input("Your name: ") year = int(input("Your birth year: ")) # input() gives TEXT; int() converts it print(f"{name}, you turn {2026 - year} in 2026")Example age = int(input("Your age: ")) โ drop the int() and the next line, age + 5, fails with "can only concatenate str".
Practice Ask for a name and a birth year, then print a sentence like "Asha, you turn 22 in 2027" using one f-string.
Module 2Making the program decide2 of 53 lessons
Week 2 โ conditions and loops. This is where a script starts doing work instead of taking notes.
if, elif, else
A condition is a yes/no question the program asks itself. Indentation is the syntax in Python โ four spaces make the block, and nothing else does.
The lesson
A condition is a yes-or-no question the program asks itself, and the branch it takes decides what happens next.
if marks >= 75:prints a distinction,elif marks >= 40:prints a pass,else:handles everything left. Python runs the FIRST true branch and stops looking, which is why the order of the conditions is part of the logic, not decoration.The syntax rule that trips everyone is indentation. In most languages a block is marked with braces; in Python it is four spaces. Your editor inserts them for you if you end a line with a colon โ take the help. Conditions combine with
and,orandnot, and you can compare text as well as numbers:if city.lower() == "pune":ignores how the person capitalised it.The mistake is putting the broad condition first: with
if marks >= 40written aboveif marks >= 75, a distinction never reaches its own branch. Read your conditions top to bottom and ask what each one has already ruled out.marks = 82 if marks >= 75: print("Distinction") elif marks >= 40: print("Pass") else: print("Needs work")Example if marks >= 40: print("Pass") elif marks >= 75: print("First class") else: print("Needs work") โ order matters, because the first true branch wins.
Practice Write a program that labels a number as positive, negative or zero, then extend it to label a mark as fail, pass, first class or distinction.
for and while loops
A for loop walks through a collection; a while loop repeats until a condition stops being true. Repeating something 100 times by hand is not a skill, it is an error waiting to happen.
The lesson
A
forloop walks through a collection and stops by itself:for n in range(1, 6):runs five times with n taking 1 to 5 โ note thatrangeexcludes the last number, which is deliberate and worth remembering. Awhileloop repeats for as long as its condition stays true, and you are responsible for making it false;while count <= 10:needs a line inside that increasescount, or the program runs for ever.The practical difference is which one you reach for. Looping over a known set โ ten marks, the rows of a file, the questions in a quiz โ is a
for. Repeating until something happens โ until the user types quit, until a balance reaches zero โ is awhile. Both acceptbreakto exit early andcontinueto skip to the next round, and both are why a computer can do in a second what takes you an hour.The two mistakes to know: an endless
whileloop because nothing inside changes the condition (Ctrl+C stops it โ that is not a crash), and off-by-one errors from forgetting thatrange(1, 5)stops at 4. When a loop misbehaves, print the counter on the first three rounds instead of guessing.for n in range(1, 6): # 1, 2, 3, 4, 5 โ the last number is excluded print(n, n * n) count = 1 while count <= 3: print("Round", count) count += 1 # without this line the loop never endsExample for n in range(1, 6): print(n * n) prints the first five squares. for name in ["Asha", "Ravi"]: walks a list, one item at a time.
Practice Print a table of 7 from 1 to 10 with a for loop, then print the same table with a while loop and decide which reads better.
Lists โ one name, many values
A list holds an ordered set of values: marks = [72, 88, 65]. Indexing starts at 0, and slicing gets a piece: marks[0:2] is the first two.
The lesson
A list keeps several values in order under one name:
marks = [72, 88, 65]. Position one is writtenmarks[0], because counting starts at zero, and a slice gets a piece:marks[0:2]is the first two values.len(),sum(),sorted(),append()andremove()cover almost everything a first job asks for.What makes a list powerful is that the computer does the repetitive work:
sum(marks) / len(marks)is the average in one line, and it still works when the list has ten thousand values instead of three. Looping over a list โfor mark in marks:โ is the pattern behind every marksheet, attendance sheet and report you will ever write.The mistakes are small and constant: using
marks[1]when you meant the second value and getting the first, trying tosum()a list of text because the numbers came from an input file, and editing a list while looping over it. Convert first with[int(x) for x in marks], then calculate.marks = [72, 88, 65, 90] print(marks[0]) # 72 โ counting starts at 0 print(marks[0:2]) # [72, 88] print(max(marks), min(marks), round(sum(marks) / len(marks), 1)) marks.append(77) # add one marks.sort(reverse=True) # highest first print(marks)Example sum(marks) / len(marks) gives the average in one line โ the same three lines of manual addition a beginner usually writes first.
Practice Store ten marks in a list and print the highest, the lowest and the average without writing a single if statement by hand.
Module 3Reusable code and honest errors3 of 53 lessons
Week 3 โ functions, dictionaries and handling failure. The week your programs stop being one long script.
Functions
A function is a named block you can call again. It takes inputs (parameters), does one job, and returns a result.
The lesson
A function is a named block you can call again with different inputs.
def average(numbers):starts the definition, the indented lines below are the body, andreturnhands a value back to whoever called it. Parameters are the inputs in brackets; arguments are the values you pass when you call it.The reason to use them is not tidiness, it is change. If the average is calculated in four places and the rule changes, you edit four places and miss one. With
average(marks)you edit one line. Name a function for the job โclean_name,total_by_categoryโ and keep it to one job; a function that also prints, saves and emails is three functions wearing one coat.The two beginner mistakes are printing the result instead of returning it (so the caller gets
Noneand cannot reuse it) and writing a function that depends on a variable defined outside itself. Both make the function work in the one place it was tested and fail everywhere else.def average(numbers): if not numbers: return 0 return sum(numbers) / len(numbers) print(average([72, 88, 65])) # 75.0 print(average([])) # 0, no crashExample def average(numbers): return sum(numbers) / len(numbers) โ then average([72, 88, 65]) works anywhere, including in a program you write next month.
Practice Turn three pieces of your own code into functions and call each one twice with different values.
Dictionaries โ data with names
A dictionary stores labelled values: student = {"name": "Asha", "marks": 72}. It is how one record with several fields is kept together, and it is everywhere in real code and APIs.
The lesson
A dictionary stores labelled values:
student = {"name": "Asha", "marks": 72}. You read a value by its label,student["marks"], not by its position โ which is exactly how a form, a JSON file from an API and a database row are shaped. A list of dictionaries, one per row, is the standard way to hold a whole table in memory.student.get("email", "not given")returns a default instead of crashing when the key is missing, andfor key, value in student.items():walks the whole record. Counting things is its best trick:counts[name] = counts.get(name, 0) + 1builds a frequency table in one line, which is how you answer "how many students chose each city".The mistake that ends programs is reading a key that is not there:
student["email"]on a dictionary without it raises KeyError. Use.get(), or checkif "email" in student:first. Also remember that anything treating your keys as positions (student[0]) is a list habit leaking in.student = {"name": "Asha", "marks": 72, "city": "Pune"} print(student["marks"]) # 72 print(student.get("email", "not given")) # no crash on a missing key counts = {} for city in ["Pune", "Delhi", "Pune"]: counts[city] = counts.get(city, 0) + 1 print(counts) # {'Pune': 2, 'Delhi': 1}Example student["marks"] returns 72; student.get("email", "not given") returns a default instead of crashing when the key is missing.
Practice Store five students as a list of dictionaries and print a marksheet sorted from highest to lowest.
Reading an error instead of fearing it
A traceback is a map, not a punishment: the last line names the error, and the line above it points at the file and line number where it happened.
The lesson
A traceback is a map. Read it from the bottom: the last line names the error, the line above it gives the file and the line number where it happened, and everything above that is the path the program took to get there.
ValueError: invalid literal for int() with base 10: "abc"means you tried to convert text that is not a number.Four errors cover most of your first month.
NameErrorโ you used a variable that does not exist, usually a typo.TypeErrorโ you mixed a string and a number.IndexErrorโ you asked a list for a position it does not have.IndentationErrorโ a block's spaces are wrong. None of them mean you are bad at this; they mean the program told you exactly which line to look at.The habit worth building now: read the LAST line first, look at that line number, and fix one thing at a time. The mistake is scrolling to the top of a long traceback, feeling lost, and rewriting the whole file โ which throws away working code and usually adds the same bug back.
value = "abc" try: number = int(value) except ValueError as e: print("Could not convert:", e) # invalid literal for int()...Example ValueError: invalid literal for int() with base 10: "abc" tells you exactly which conversion failed โ you passed text where a number was expected.
Practice Break your own program in three different ways on purpose and write down, in one line each, what the traceback told you.
Module 4Files and real data4 of 53 lessons
Week 4 โ read a file, clean it, summarise it. The week the course becomes useful beyond the classroom.
Reading and writing files
with open("data.txt") as f: reads a file and closes it for you, even if the code inside fails โ which is why `with` is the pattern to learn first.
The lesson
with open("data.txt") as f:opens a file and closes it for you, even if the code inside fails โ which is whywithis the pattern to learn first and not a shorthand to upgrade to later. Thenfor line in f:walks it one line at a time, which is how large files are read without loading all of them into memory at once.Writing takes a mode:
open("report.txt", "w")replaces the file, while"a"appends to it. That difference has wiped out more data than any other beginner line of code โ use"a"when you are adding today's entry to yesterday's. Each line you write ends with\n, and each line you read arrives with one, which is whyline.strip()appears in almost every file loop.The mistake is a path that is not where you think it is.
data.txtmeans "in the folder the program was started from", not "next to my script" โ use an absolute path while learning, and get in the habit of opening the file in your editor to confirm the write actually happened.with open("notes.txt", "a") as f: # "a" appends; "w" would wipe the file print("Learned functions today", file=f) with open("notes.txt") as f: for line in f: print(line.strip())Example for line in f: print(line.strip()) โ strip() removes the newline character that would otherwise print a blank line between every row.
Practice Write a program that writes three lines to a file and then reads them back, printing the count of lines.
CSV โ the format every office runs on
CSV is plain text with commas: the format of exports from Excel, Google Sheets and almost every college and office system.
The lesson
CSV is a plain text file where each line is a row and commas separate the fields. It is what Excel, Google Sheets, banking portals and college systems export, which is why it is the first data format worth knowing โ not because it is clever, but because everything ends up in it.
import csvthencsv.reader(f)gives you one list per row, sorow[0]is the first column androw[2]the third. When the file has a header,csv.DictReader(f)is better: every row arrives as a dictionary keyed by the column names, so you writerow["city"]instead of counting commas and hoping. Read the header row first and print it โ you are then certain which column is which before you write any logic.The mistake is assuming the file is clean: extra blank lines, extra spaces after commas, amounts written as "1,200" with a comma inside the field, and one stray semicolon instead of a comma will all break a loop. Print the first five rows before writing anything clever, and count the columns in each โ that five-second check is what separates someone who debugs for an hour from someone who does not.
import csv with open("students.csv", newline="") as f: for row in csv.DictReader(f): print(row["name"], row["city"]) # keyed by the header rowExample import csv then csv.reader(f) gives one list per row, so row[0] is the first column โ exactly how a marks or attendance sheet is structured.
Practice Export any real spreadsheet to CSV, read it in Python, and print the number of rows and the column names.
Cleaning mess before analysing it
Real data has blank cells, stray spaces and inconsistent capitals. Cleaning is the first 60% of every data job, not a preliminary nobody does.
The lesson
Cleaning is not the boring part before the real work; it IS the work, and it is roughly the first sixty per cent of any data job. Real columns contain " asha ", "Asha", "ASHA" and an empty cell, and any calculation built on top of that will be wrong in a way that looks right.
Three clean-ups solve most of it. Trim the spaces:
value.strip(). Standardise the case:.title()for names,.lower()for emails and categories. And drop the rows that cannot be used rather than guessing:if not row["city"]: continue. Print a count of how many rows you removed and why โ a report that says "412 rows read, 9 skipped for a blank city" is a report a manager believes.The mistake is cleaning silently. Nobody can check a number they cannot see the steps behind, so write the count of rows in, rows used and rows dropped at the top of your output. That is also the first thing an interviewer asks about a data project โ and the first thing a fresher cannot answer.
import csv kept, dropped = 0, 0 with open("raw.csv", newline="") as f: for row in csv.DictReader(f): city = (row["city"] or "").strip().title() if not city: dropped += 1 continue kept += 1 print(city) print(f"kept {kept}, skipped {dropped} with a blank city")Example value.strip().title() turns " asha " into "Asha"; skipping rows where the key column is empty removes the junk rows a manual export always leaves.
Practice Clean your CSV: trim spaces, skip empty rows, standardise one text column, and print how many rows you removed and why.
Module 5Three projects and a shareable repo5 of 53 lessons
Weeks 5โ6 โ build the proof. Projects are what a fresher shows instead of experience.
Project 1 โ Expense tracker
A menu-driven program that records expenses, saves them to a CSV and prints a monthly total per category. It exercises input, loops, dictionaries and files in one piece of work.
The lesson
An expense tracker is a menu-driven program: add an expense, list this month's expenses, show the total per category, quit. It is the smallest project that uses everything in the first four modules at once โ input, conditions, loops, functions, dictionaries and file writing โ which is why it is project one rather than a bigger, half-finished idea.
A single
expenses.csvwith the columns date, category, amount is the whole storage layer. No database, no framework, nothing a reviewer has to install to run โ a person who can open your project with one command is a person who will actually read it. Read the file into a list of dictionaries at start-up, add to the list as the user works, and write the whole list back when they choose to save.The mistake that makes this project fail is building the interface first and the data second. Write the file format down, write one function that parses a line into a dictionary, then build the menu around functions you already know work. It also needs to survive being closed: start it twice, add an expense each time, and check the first one is still there.
Example A single expense.csv with columns date, category, amount is enough โ no database, no framework, nothing that can fail to install on a reviewer's machine.
Practice Build it end to end and make sure it survives being closed and reopened without losing the earlier entries.
Project 2 โ Quiz from a file
Read questions from a text or CSV file, ask them one at a time, score the answers and print a result โ the shape of nearly every exam and survey program.
The lesson
A quiz program reads questions from a file, asks them one at a time, records the answers and prints a result. Its shape โ read a set of items, present each, score the response, summarise โ is the shape of nearly every exam, survey, form and interview-rating tool you will ever be asked to build.
Keep the questions in
questions.csvwith the columns question, correct answer, so adding a question needs no code change. Score into a list of dictionaries rather than a single running total, because that is what lets you print an answer-wise report at the end โ "question 4: you said B, correct was C". Handle an empty answer by asking again rather than crashing, and shuffle the order if you want a second attempt to mean anything.The mistake is hiding the questions inside the code, which makes the program impossible to reuse and impossible to hand over, and the second is scoring into one number: a total of 6 out of 10 tells the user nothing about what to fix, and telling people what to fix is the point.
Example Storing questions in questions.csv instead of inside the code means adding a question needs no code change โ a design decision worth mentioning in an interview.
Practice Add ten questions of your own, handle a blank answer without crashing, and print an answer-wise report at the end.
Project 3 โ Publish it properly
A GitHub repository with a README is the version of "I know Python" a recruiter can verify in thirty seconds. Code nobody can open does not count as proof.
The lesson
A project nobody can open does not count as proof of anything. Publishing means a GitHub repository with your code, a README explaining what it does, and a link you can put on a resume โ that is the version of "I know Python" a recruiter can verify in thirty seconds, which is exactly how long they will give it.
The README only needs four things: the project name in one line, a sentence on what it does, the exact command to run it, and a sample of the output. Add a screenshot if the program prints a table. Then put the repository link on your resume next to the project name and in your LinkedIn profile โ a repository that appears nowhere is a repository nobody visits.
The mistake is one repository containing all three projects in one file called
main.py, which reads as a student exercise rather than work. Separate repositories, or clearly separate folders with a README each, and commit as you build rather than uploading everything on the last day: the commit history is itself evidence that you wrote it.Example A README with the project name, one line on what it does, a screenshot or sample output, and the exact command to run it is enough โ three files, no build step.
Practice Push all three projects, write each README, and put the repository link in your resume and LinkedIn profile.
About Python for Absolute Beginners
Write real Python programs โ read a data file, clean it and print a summary โ in six weeks, with no coding experience to start from.
School and college students, non-IT graduates and career switchers who have never written a line of code and want an honest first foothold in programming.
What you will be able to do at the end
- Install Python and run a script on your own machine โ and in a browser when you have to borrow a computer
- Use variables, strings, numbers, lists and dictionaries without looking up the syntax every time
- Make a program decide and repeat with if/else and loops, instead of testing it by hand
- Write your own functions, so a program you already wrote can be reused instead of retyped
- Read and clean a real CSV file, then print a summary an interviewer would accept
- Explain any line of your own code out loud โ the skill technical interviews actually test
How the course is structured
5 modules and 15 lessons, arranged so each one ends with something you have built. Every lesson carries a worked example and a practice task โ the practice is the course, the reading is only the setup. Plan for 6 weeks ยท about 6 hours a week.
The full syllabus โ every lesson, its example and its practice task โ is in the Course curriculum below. Nothing is locked and nothing needs an account.
Your weekly routine
- Two weeknights of 90 minutes: one lesson, then its practice task written out by hand before typing it in.
- One 3-hour weekend block: finish the module project for that week and push the code.
- Fifteen minutes on the day after a session re-reading your own code and rewriting one function more cleanly.
What you will have built by the end
- Expense tracker โ records, saves and summarises to a CSV
- Quiz program โ reads questions from a file and reports an answer-wise score
- A published GitHub repository with a README a recruiter can follow
Where this leads for a fresher
- Support and manual-testing roles that need scripting
- Junior Python or automation trainee
- Data-entry-to-data-analyst transitions
- Internships where the first task is scripting a repetitive process
Titles vary between companies; the evidence does not. A deployed project, a set of queries you can explain, or a case study with real testing behind it is what a fresher interview has to work with.
Frequently asked questions
Do I need to be good at maths?
No. Nothing in this course goes past averages and percentages. Maths matters for machine learning, which is a later, separate step โ treating it as a gate to programming is the single most common reason students never start.
I only have a phone. Can I still do it?
You can learn and read on a phone, but you must type the code, and typing a loop on a phone keyboard is painful. Plan for two hours a week on any shared computer โ a college lab, a friend's laptop or a cyber cafรฉ. Writing it yourself is the part that teaches.
Is this course free?
Yes. The lessons, examples and practice tasks are free to read and to follow. The certificate, where a course offers one, is booked separately from the course page.
How do I know if I am actually ready for a job after this?
Take the free Career Pulse check. It scores your skills, communication and goal clarity against the roles you are aiming for and returns a roadmap of exactly what to fix first. Six weeks of Python with nothing else built still scores low โ and knowing that before you apply is worth more than a certificate.
Not sure which of these you need first? The free Career Pulse check scores your skills, communication and goal clarity in about three minutes and tells you which gap to close first. Take the free check.