Day 3: Reviewing Yesterday’s Challenge + Virtual Environments & Repositories
Day 2 Challenge Review: How Did You Do?
Before we move forward, let’s recap the mini-challenge from Day 2:
✅ Store your full name as a string and print it.
✅ Create two numbers and add them together.
✅ Store a boolean value and check its type.
✅ Convert an integer to a string and print its type.
✅ Create a list of 5 favorite foods and print the first one.
Common Mistakes & Fixes
π΄ Forgetting to use quotation marks for strings
✔️ Fix: full_name = "John Doe"
instead of full_name = John Doe
π΄ Using +
instead of ,
in print statements
✔️ Fix:
print("My name is", full_name) # ✅ Works correctly
print("My name is " + full_name) # ✅ Also works
But this would fail:
print("My name is" + 25) # ❌ TypeError: can only concatenate str (not "int") to str
To fix this, convert the number to a string:
print("My name is " + str(25)) # ✅ Works correctly
π΄ Forgetting that lists are zero-indexed
✔️ Fix: If your list is foods = ["Pizza", "Burger", "Sushi", "Pasta", "Ice Cream"]
, the first item is accessed as foods[0]
, not foods[1]
.
Standout Submissions π
Some of you went the extra mile by adding user input, loops, and functions—amazing! Keep pushing yourself! πͺ
π Special shoutout to those who shared their results in the WhatsApp group! If you haven’t yet, go ahead and drop your screenshots! πΈ
Day 3: Virtual Environments & Repositories
Now that we’ve warmed up, let’s dive into today’s core topics:
✅ Virtual Environments – Keeping projects organized and avoiding dependency conflicts.
✅ Repositories (Git & GitHub) – Backing up your code, collaborating, and tracking changes like a pro.
By the end of this session, you'll set up a virtual environment and push your first Python project to GitHub! πͺ
1️⃣ Why Use Virtual Environments?
Imagine working on two different Python projects, and one requires Django 3.2 while the other needs Django 4.0. Without virtual environments, your system might break because Python doesn’t know which version to use! π¬
A virtual environment:
πΉ Creates an isolated workspace for each project.
πΉ Prevents dependency conflicts between projects.
πΉ Keeps your global Python setup clean and organized.
Setting Up a Virtual Environment
Windows π₯️
1️⃣ Open Command Prompt (cmd).
2️⃣ Navigate to your project folder:
cd path\to\your\project
3️⃣ Create a virtual environment:
Comments
Post a Comment
Share your thoughts...