Python Basics in 7 Days: Variables, Loops & Functions for Absolute Beginners

Python Basics in 7 Days: Variables, Loops & Functions for Absolute Beginners

Python Basics in 7 Days: Variables, Loops & Functions for Absolute Beginners

Introduction

You’ve decided to learn Python. Maybe you want to move into data science, automate boring tasks, or just see what coding feels like. The first question is always the same: where do I even start?

This guide gives you a simple, realistic 7-day plan. Each day has one focus, short code you can run yourself, and a small practice task. By the end of the week you’ll understand the building blocks every Python program uses: variables, conditions, loops, and functions, plus lists, dictionaries, and a mini project that ties it all together.

One honest note before we begin: a week won’t make you job-ready. What it will do is get you past the hardest part, which is starting, and give you a foundation you can build on with structured practice.

What You Need Before Day 1

  • A computer with Windows, macOS, or Linux; any basic configuration runs Python
  • Python 3 installed from python.org
  • A code editor such as VS Code, or an online option like Google Colab if you’d rather not install anything
  • 45 to 90 minutes a day. Consistency beats long, occasional sessions
  • A habit of typing the code yourself instead of copy-pasting

Your 7-Day Plan at a Glance

DayTopicWhat You’ll Be Able to Do
1Setup and your first programRun Python code and print output
2Variables and data typesStore and work with numbers, text, and True/False values
3Conditions (if/else)Make your program choose between options
4LoopsRepeat actions without rewriting code
5FunctionsPackage code into reusable pieces
6Lists, dictionaries, and stringsHandle collections of data
7Mini projectCombine everything into a working program

Day 1: Setup and Your First Program

Goal: Get Python running and see your first output.

Python is popular with beginners because its code reads almost like plain English. Open your editor, create a file called day1.py, and type:

print("Hello, Python!")

Run it. If you see Hello, Python! on screen, you’ve just written and executed your first program.

Key ideas for today:

  • print() displays something on the screen
  • Text goes inside quotes
  • Python runs your code line by line, from top to bottom
  • Lines starting with # are comments, which are notes for humans that Python ignores

Practice: Print your name, your city, and one thing you want to build with Python, each on its own line.

Day 2: Variables and Data Types

Goal: Store information and understand what kind of information it is.

A variable is a labeled box that holds a value. You create one with =:

name = "Aman"
age = 21
height = 5.8
is_student = True

print(name, age, height, is_student)
print(type(age))

The four types you’ll use constantly:

TypeExampleUsed For
str (string)"Aman"Text
int (integer)21Whole numbers
float5.8Decimal numbers
bool (boolean)True / FalseYes/no decisions

You can do math with numbers and combine text using f-strings:

price = 250
quantity = 3
total = price * quantity
print("Total:", total)
print(f"{name} is {age} years old")

Key ideas for today:

  • Variable names should be meaningful (total_price, not x)
  • Names are case-sensitive: Age and age are different
  • type() tells you what kind of value you’re holding
  • Operators: +, -, *, /, // (whole-number division), % (remainder), ** (power)

Practice: Store the price and quantity of an item you’d buy, calculate the total with 18% GST added, and print a friendly sentence with the result.

Day 3: Conditions (if / elif / else)

Goal: Make your program decide.

Real programs choose between paths. Python does this with if, elif, and else:

marks = 72

if marks >= 90:
    print("Grade A")
elif marks >= 60:
    print("Grade B")
else:
    print("Keep practicing")

Key ideas for today:

  • Comparison operators: ==, !=, >, <, >=, <=
  • Logical operators: and, or, not
  • Indentation matters. The indented lines are the ones that belong to the if. Four spaces is the standard
  • Don’t confuse = (assign a value) with == (check if equal)

Practice: Write a program that checks a number and prints whether it’s positive, negative, or zero. Then extend it to say whether it’s even or odd.

Day 4: Loops

Goal: Repeat tasks without copying code.

Imagine printing the numbers 1 to 100. You wouldn’t type 100 lines. A loop does it for you.

The for loop repeats a set number of times:

for i in range(1, 6):
    print(i)

The while loop repeats as long as a condition stays true:

count = 3
while count > 0:
    print(count)
    count -= 1

You can combine loops with conditions to filter things:

for n in range(1, 21):
    if n % 3 == 0:
        print(n)

Key ideas for today:

  • range(1, 6) produces 1, 2, 3, 4, 5 (the end number is not included)
  • while loops need something inside that eventually makes the condition false, otherwise they run forever
  • break exits a loop early; continue skips to the next round

Practice: Print the multiplication table of any number. Then write a loop that adds up all the numbers from 1 to 50.

Day 5: Functions

Goal: Write code once, use it many times.

A function is a named block of code that does one job. You define it with def and call it by name:

def greet(name):
    return "Hello, " + name + "!"

print(greet("Python"))

Functions can take several inputs (parameters) and send back a result with return:

def area_of_rectangle(length, width):
    return length * width

print(area_of_rectangle(4, 5))

Key ideas for today:

  • Define first, then call
  • Parameters are the inputs a function expects; arguments are the actual values you pass in
  • return sends a value back; print only displays something
  • Good functions do one thing and have clear names

Practice: Write a function that converts a temperature from Celsius to Fahrenheit. Then write another that takes a number and returns whether it’s even.

Day 6: Lists, Dictionaries, and Strings

Goal: Handle groups of data, which is what most real programs do.

Lists hold ordered collections:

fruits = ["apple", "banana", "mango"]
fruits.append("orange")

print(fruits[0], len(fruits))

for fruit in fruits:
    print(fruit.upper())

Dictionaries store information as key-value pairs:

student = {"name": "Riya", "age": 20, "city": "Delhi"}
print(student["name"])

student["course"] = "Python"

Strings come with handy built-in tools:

text = "python basics"
print(text.title(), text.replace("basics", "rocks"))
StructureBest ForExample
ListOrdered items you may changeA list of marks
DictionaryLabeled informationA student’s profile
StringTextA name or message

Key ideas for today:

  • List positions start at 0, not 1
  • Dictionary values are fetched using their key
  • Loops and lists work together constantly, and this combination is the heart of data handling in Python

Practice: Make a list of five marks, then use a loop to find the highest, the lowest, and the average. Create a dictionary for yourself and print each key and value.

Day 7: Your Mini Project, a Simple Expense Tracker

Goal: Combine variables, conditions, loops, functions, lists, and dictionaries in one program.

def add_expense(expenses, name, amount):
    expenses.append({"name": name, "amount": amount})

def total_spent(expenses):
    result = 0
    for item in expenses:
        result += item["amount"]
    return result

expenses = []

while True:
    name = input("Expense name (or 'done'): ")
    if name == "done":
        break
    amount = float(input("Amount: "))
    add_expense(expenses, name, amount)

print("\nYour expenses:")
for item in expenses:
    print(item["name"], "-", item["amount"])

print("Total spent:", total_spent(expenses))

Notice how every concept from the week shows up: a function to add expenses, a function to total them, a while loop to keep asking, an if to stop, a list to store items, and dictionaries to describe each one.

Stretch challenges:

  • Warn the user if the total crosses a budget limit you set
  • Print the most expensive item
  • Ask for a category for each expense and show the total per category

Cheat Sheet: Python Basics at a Glance

ConceptSyntaxRemember
Printprint("text")Shows output
Variablex = 10One = assigns
Conditionif x > 5:Indent the block
For loopfor i in range(5):Runs a fixed number of times
While loopwhile x > 0:Needs a way to stop
Functiondef name(a, b):Use return for results
List[1, 2, 3]Starts at index 0
Dictionary{"key": "value"}Access by key

Common Beginner Errors (And How to Fix Them)

ErrorUsually MeansFix
SyntaxErrorA typo, a missing colon, or a missing bracketRe-read the line and the one above it
IndentationErrorInconsistent spacingUse four spaces consistently
NameErrorUsing a variable that doesn’t exist yetCheck spelling and order
TypeErrorMixing types, such as adding text and a numberConvert with int(), float(), or str()
IndexErrorAsking for a list position that isn’t thereCheck the list length
KeyErrorAsking for a dictionary key that isn’t thereCheck the key’s spelling

Reading error messages is a skill. Look at the last line first, then the line number. Most bugs are small.

How to Make the Week Actually Work

  • Type everything yourself. Copy-pasting teaches your clipboard, not your brain
  • Change the code and see what breaks. Experimenting is how it sticks
  • Do the practice task before moving on. Reading is not the same as understanding
  • Keep every file. A folder of small programs becomes your first portfolio
  • Use AI assistants carefully. They’re great for explaining an error message, but try the problem yourself first
  • Don’t aim for perfect. Working and messy beats polished and unfinished

What to Learn After Day 7

A week gives you the grammar. Fluency comes from practice and a clear path forward.

Next StepWhat It Adds
Tuples, sets, and more string and list methodsDeeper control over data
File handling and error handlingReading real files and writing reliable programs
Object-oriented programmingOrganizing larger programs
NumPy, Pandas, and MatplotlibData analysis and visualization
Flask or DjangoWeb development with Python
Scikit-learn and beyondMachine learning and AI
Small real projectsProof of skill for jobs and freelancing

Most learners find they need a few more weeks of steady practice to feel comfortable, and a few more months to become job-ready in a specialization such as data science, automation, or development.

Where to Keep Learning in Delhi

Self-study works for many people, but it’s easy to get stuck on errors, lose momentum, or not know what to learn next. Structured classes help with live doubt-solving, assignments, and feedback from trainers who’ve worked with Python professionally.

Python Training Institute in South Extension, New Delhi offers classroom-based Python training for beginners, students, and working professionals, with both offline and online options and a free demo class so you can try it before you commit. East Delhi learners can look at the Python course in Laxmi Nagar.

Once your Python foundation is solid, you can move into specializations such as the Data Science Course in Delhi, the Machine Learning Course in Delhi, the AI Course in Delhi, or the Full Stack Development Course in Delhi.

Frequently Asked Questions

Can I really learn Python basics in 7 days? You can learn the core building blocks, which are variables, conditions, loops, functions, lists, and dictionaries, in a week of focused practice. Becoming confident and job-ready takes longer.

Do I need any coding experience? No. Python is one of the easiest languages to start with, and this plan assumes you’ve never coded before.

How many hours a day should I study? About 45 to 90 minutes of focused practice is enough. Typing and running the code yourself matters more than the number of hours.

Which Python version should I install? Install the latest stable Python 3 release from python.org.

What if I get stuck on an error? Read the last line of the error message, check the line number, and look for typos, missing colons, or inconsistent indentation. If it still doesn’t make sense, ask a trainer, a classmate, or an AI assistant to explain it, after you’ve tried yourself.

What should I learn after the basics? Go deeper into data structures and file handling, then choose a direction: data analysis with Pandas, web development with Flask or Django, or machine learning with Scikit-learn.

Is a classroom course better than learning alone? Neither is universally better. Classroom training adds structure, doubt-solving, and accountability, which helps many beginners stay on track and finish projects.

Final Thoughts

Python rewards beginners because the language gets out of your way. In seven days, you’ve seen how programs store information, make decisions, repeat actions, and organize code into reusable functions. Those four ideas show up in every Python program you’ll ever read or write, from a tiny script to a machine learning model.

Don’t stop at day 7. Re-do the mini project with your own twist, build something that solves a small problem in your own life, and keep going every day. The learners who succeed aren’t the fastest. They’re the ones who keep showing up.


Ready to go beyond the basics with guided practice? Visit Python Training Institute to book a free demo class and talk to a counselor about the right Python course for your goals.