0% found this document useful (0 votes)
79 views4 pages

Learn Python in 7 Days

Simple 7 days tutorial

Uploaded by

prabhakaran.d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views4 pages

Learn Python in 7 Days

Simple 7 days tutorial

Uploaded by

prabhakaran.d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Learn Python in 7 Days: A Beginner's Crash Course

Introduction

Welcome to the 7-day Python crash course! This guide is designed for absolute
beginners with no prior programming experience. By the end of this week, you will
understand the fundamental concepts of Python and build a small, functional
application.

What is Python? 🐍

Python is a powerful, versatile, and easy-to-read programming language. It's used


everywhere, from web development (Instagram, YouTube) and data science to
artificial intelligence.

Setup:

Before you start, you'll need:

1. Python: Download and install the latest version from python.org.


2. A Code Editor: We recommend using Visual Studio Code (VS Code), which
is free and easy to use.

Day 1: The Absolute Basics

Today, we'll cover the building blocks of Python.

• Topics:
o The print() function: How to display output.
o Variables: Storing data (text, numbers).
o Data Types: Strings ("hello"), Integers (10), and Floats (3.14).
o User Input: Getting information from the user with input().
o Simple Math: Operators like +, -, *, /.
• Daily Project: Simple Calculator 🧮

Write a program that asks the user for two numbers and then adds, subtracts,
multiplies, and divides them, printing the result of each operation.

Python

# Example Snippet
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))

sum_result = num1 + num2


print(f"The sum is: {sum_result}")

Day 2: Lists and Loops


Learn how to store multiple items and repeat actions.

• Topics:
o Lists: Creating ordered collections of items (e.g., my_tasks = ["laundry",
"dishes"]).
o Accessing List Items: Using index numbers (e.g., my_tasks[0]).
o Modifying Lists: Using .append() to add items and .remove() to delete
them.
o for Loops: How to repeat a block of code for each item in a list.
• Daily Project: To-Do List Manager 📝

Create a simple to-do list. The program should have a pre-defined list of tasks
and use a for loop to print each task on a new line. Then, ask the user for a
new task to add to the list and print the updated list.

Day 3: Conditional Logic

Make your programs "smart" by allowing them to make decisions.

• Topics:
o if, elif, else statements: Running code only when a certain condition is
true.
o Comparison Operators: Checking for equality (==), inequality (!=),
greater than (>), and less than (<).
o bool values: True and False.
• Daily Project: Number Guessing Game 🤔

The program will think of a secret number (e.g., secret_number = 7). Ask the
user to guess the number. If they guess correctly, print "You win!". If they
guess wrong, tell them if their guess was too high or too low.

Day 4: Dictionaries

Learn a new way to store data in key-value pairs.

• Topics:
o Dictionaries: Storing data in an unordered collection of key: value pairs
(e.g., contact = {"name": "John", "phone": "123-4567"}).
o Accessing Values: Using keys (e.g., contact["name"]).
o Adding/Updating Entries: Modifying the dictionary.
• Daily Project: Simple Contact Book 📖

Create a dictionary to store a few contacts with their names and phone
numbers. Ask the user to enter a name. If the name exists in your contact
book, print their phone number. Otherwise, print a "Contact not found"
message.
Day 5: Functions

Organize your code into reusable blocks.

• Topics:
o Defining Functions: Using the def keyword.
o Parameters & Arguments: Passing data into your functions.
o The return Statement: Getting data back from a function.
• Daily Project: Upgraded Calculator ⚙

Rewrite your calculator from Day 1. This time, create separate functions for
add(a, b), subtract(a, b), etc. Your main program will call these functions to
get the results. This makes your code cleaner and reusable.

Day 6: while Loops and Bringing It Together

Learn another type of loop and start combining concepts.

• Topics:
o while Loops: Repeating code as long as a condition is True.
o Breaking Loops: Using the break keyword to exit a loop early.
o Project Planning: Thinking about how different concepts fit together.
• Daily Project: Interactive Menu 📋

Create a menu for your To-Do List from Day 2. Use a while loop to
continuously show the user options like "1. View Tasks", "2. Add Task", "3.
Exit". The loop should only end when the user chooses "Exit".

Day 7: Final Project - Simple Quiz Game

Combine everything you've learned to build a complete program.

• Project Goal:

Create a simple, multiple-choice quiz game that asks the user a series of
questions, checks their answers, and gives them a final score.

• Concepts Used:
o Lists and Dictionaries to store the questions, options, and answers.
o for Loops to iterate through the questions.
o input() to get the user's answer.
o if/else statements to check if the answer is correct.
o Variables to keep track of the score.
o print() to display questions, feedback, and the final score.
• Example Structure:
Python

# A list of dictionaries, where each dictionary is a question


questions = [
{
"prompt": "What color is the sky? (a) Blue (b) Green (c) Red",
"answer": "a"
},
{
"prompt": "What is 2+2? (a) 3 (b) 4 (c) 5",
"answer": "b"
}
]

score = 0
for question in questions:
answer = input(question["prompt"] + "\n> ")
if answer == question["answer"]:
print("Correct!")
score += 1
else:
print("Incorrect!")

print(f"You got {score}/{len(questions)} correct!")

You might also like