Skip to content

Commit 8208a8b

Browse files
authored
Add files via upload
Signed-off-by: Bubbles The Dev <[email protected]>
0 parents  commit 8208a8b

28 files changed

+1160
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
## 🔢 **4. Basic Operations and Real-World Tasks (10 mins)**
2+
3+
### ✅ **Math Operations:**
4+
5+
salary = 55000 # Annual Salary 💰
6+
bonus = 5000 # Performance Bonus 💸
7+
total_income = salary + bonus # Total Income 💵
8+
print("Total Income:", total_income) # Output: Total Income: 60000
9+
10+
#--------------------------------------------
11+
12+
### ✅ **Real-World Example: Automating Salary Calculation**
13+
14+
hours_worked = 160 # Hours Worked 🕒
15+
hourly_rate = 25 # Hourly Rate 💲
16+
monthly_income = hours_worked * hourly_rate # Monthly Income 💵
17+
print("Monthly Income:", monthly_income) # Output: Monthly Income: 4000
18+
19+
#--------------------------------------------
20+
21+
### 🛠️ **Student Activity:**
22+
23+
# - Write a program to calculate your **monthly savings** after deducting rent and utilities.
24+
25+
#------------------------------------------------
26+
27+
# Print Basic Operations and Real-World Tasks
28+
print("## 🔢 **4. Basic Operations and Real-World Tasks (10 mins)**\n")
29+
30+
# Print Math Operations Section
31+
print("### ✅ **Math Operations:**\n")
32+
print("# salary = 55000 # Annual Salary 💰")
33+
print("# bonus = 5000 # Performance Bonus 💸")
34+
print("# total_income = salary + bonus # Total Income 💵")
35+
print('# print("Total Income:", total_income) # Output: Total Income: 60000\n')
36+
37+
# Print Separator
38+
print("#--------------------------------------------\n")
39+
40+
# Print Real-World Example Section
41+
print("### ✅ **Real-World Example: Automating Salary Calculation**\n")
42+
print("# hours_worked = 160 # Hours Worked 🕒")
43+
print("# hourly_rate = 25 # Hourly Rate 💲")
44+
print("# monthly_income = hours_worked * hourly_rate # Monthly Income 💵")
45+
print('# print("Monthly Income:", monthly_income) # Output: Monthly Income: 4000\n')
46+
47+
# Print Separator
48+
print("#--------------------------------------------\n")
49+
50+
# Print Student Activity Section
51+
print("### 🛠️ **Student Activity:**\n")
52+
print("# - Write a program to calculate your **monthly savings** after deducting rent and utilities.\n")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## 🎓 **8. Build Your Portfolio (10 mins)**
2+
3+
# - **Automated To-Do List**
4+
# - **Budget Calculator**
5+
# - **Weather App**
6+
7+
# Push your projects to **GitHub** and write clear **README.md** files.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
## 🔄 **5. Control Flow for Decision Making (15 mins)**
2+
3+
### 🗣️ **What to Say:**
4+
# - Let's talk about control flow.
5+
# *"Control flow helps programs make decisions and repeat tasks efficiently."* 🔄
6+
7+
#----------------------------------------------
8+
9+
### ✅ **If-Else Example:**
10+
11+
age = 25 # Change the value to test the condition 🔢
12+
if age >= 18: # If the condition is true then the code inside the block will be executed ✔️
13+
print("Eligible for a developer job.") # This will be printed if the condition is true 🖥️
14+
else: # If the condition is false then the code inside the block will be executed ❌
15+
print("Focus on learning!") # This will be printed if the condition is false 📚
16+
17+
#----------------------------------------------
18+
19+
### ✅ **For Loop Example:**
20+
21+
for i in range(1, 6): # Loop through the range of numbers from 1 to 5 🔁
22+
print(f"Application #{i} sent!") # Print the message with the application number 📨
23+
24+
#----------------------------------------------
25+
26+
### ✅ **While Loop Example:**
27+
28+
attempts = 0 # Change the value to test the condition 🔢
29+
while attempts < 3: # If the condition is true then the code inside the block will be executed ✔️
30+
print("Retrying connection...") # This will be printed if the condition is true 🔄
31+
attempts += 1 # Increment the value of attempts by 1 ➕
32+
33+
#----------------------------------------------
34+
35+
### 🛠️ **Student Activity:**
36+
37+
# - Write a program that categorizes ages:
38+
# - Below 18: *"Student"* 🎓
39+
# - 18–25: *"Junior Developer"* 👨‍💻
40+
# - Above 25: *"Senior Developer"* 👩‍💻
41+
42+
#----------------------------------------------
43+
44+
# Print Control Flow for Decision Making Section
45+
print("## 🔄 **5. Control Flow for Decision Making (15 mins)**\n")
46+
47+
# Print Introduction to Control Flow
48+
print("### 🗣️ **What to Say:**\n")
49+
print('# - Let\'s talk about control flow.')
50+
print('# *"Control flow helps programs make decisions and repeat tasks efficiently."* 🔄\n')
51+
52+
# Print Separator
53+
print("#----------------------------------------------\n")
54+
55+
# Print If-Else Example Section
56+
print("### ✅ **If-Else Example:**\n")
57+
print("# age = 25 # Change the value to test the condition 🔢")
58+
print("# if age >= 18: # If the condition is true then the code inside the block will be executed ✔️")
59+
print("# print(\"Eligible for a developer job.\") # This will be printed if the condition is true 🖥️")
60+
print("# else: # If the condition is false then the code inside the block will be executed ❌")
61+
print("# print(\"Focus on learning!\") # This will be printed if the condition is false 📚\n")
62+
63+
# Print Separator
64+
print("#----------------------------------------------\n")
65+
66+
# Print For Loop Example Section
67+
print("### ✅ **For Loop Example:**\n")
68+
print("# for i in range(1, 6): 🔁")
69+
print("# print(f\"Application #{i} sent!\") 📨\n")
70+
71+
# Print Separator
72+
print("#----------------------------------------------\n")
73+
74+
# Print While Loop Example Section
75+
print("### ✅ **While Loop Example:**\n")
76+
print("# attempts = 0 # Change the value to test the condition 🔢")
77+
print("# while attempts < 3: # If the condition is true then the code inside the block will be executed ✔️")
78+
print("# print(\"Retrying connection...\") # This will be printed if the condition is true 🔄")
79+
print("# attempts += 1 # Increment the value of attempts by 1 ➕\n")
80+
81+
# Print Separator
82+
print("#----------------------------------------------\n")
83+
84+
# Print Student Activity Section
85+
print("### 🛠️ **Student Activity:**\n")
86+
print("# - Write a program that categorizes ages:")
87+
print("# - Below 18: *\"Student\"* 🎓")
88+
print("# - 18–25: *\"Junior Developer\"* 👨‍💻")
89+
print("# - Above 25: *\"Senior Developer\"* 👩‍💻\n")
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## 📦 **6. Functions – Reusable Code (10 mins)**
2+
3+
### ✅ **Example:**
4+
5+
def greet_user(name): # Function definition
6+
return f"Welcome, {name}!" # Function body
7+
8+
print(greet_user("Bubbles")) # Function call
9+
10+
#------------------------------------------------------------
11+
12+
### ✅ **Real-World Example: Automating Emails**
13+
14+
def send_email(recipient):
15+
print(f"Email sent to {recipient}")
16+
17+
#------------------------------------------------------------
18+
19+
### 🛠️ **Student Activity:**
20+
21+
# - Write a function that calculates annual income given `monthly_salary`.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# print("Hello, World! Welcome to Python Development! 🌍🐍")
2+
3+
# print() is a core function. It prints the string to the console. 🖥️
4+
# The string is enclosed in double quotes. 📝
5+
6+
# --------------------------------------------
7+
8+
# Student Activity: 🎓
9+
10+
# Setting Up a Developer Environment (10 mins) ⏱️
11+
# --------------------------------------------
12+
13+
# ✅ **Set Up Tools:**
14+
# 1. Install **Python 3.x** from [python.org](https://www.python.org/). 🐍
15+
# 2. Install **Visual Studio Code** or **PyCharm Community Edition**. 💻
16+
# 3. Install **Git** for version control ([git-scm.com](https://git-scm.com/)). 🔧
17+
18+
# ✅ **Create a Python File:**
19+
# 1. Open Visual Studio Code or PyCharm. 🖥️
20+
# 2. Create a new file named `hello-world.py`. 📄
21+
22+
print("Python Environment Ready! 🚀")
23+
24+
### 🧠 **Ask Students:** 🤔
25+
26+
# - *“What areas of development interest you most?”* 💡
27+
# - *“Have you ever seen a job description requiring Python skills?”* 📋
28+
29+
# --------------------------------------------
30+
31+
# ✅ **Pro Tip:** 💡
32+
33+
# - Use Virtual Environment for Python projects. 🌐
34+
35+
# python -m venv env
36+
# source env/bin/activate # Mac/Linux 🐧🍎
37+
# env\Scripts\activate # Windows 🪟
38+
# deactivate # To exit the virtual environment❌
39+
40+
#--------------------------------------------
41+
# ✅ **Common Commands:** 🛠️
42+
43+
# - Use `pip` to install Python packages. 📦
44+
45+
# pip install package-name
46+
47+
# - Use `pip freeze` to list installed packages. 📜
48+
49+
# pip freeze
50+
51+
# - Use `pip install -r requirements.txt` to install packages from a file. 📂
52+
53+
#--------------------------------------------
54+
55+
print("Hello, World! Welcome to Python Development! 🌍🐍")
56+
57+
print("print() is a core function. It prints the string to the console. 🖥️")
58+
print("The string is enclosed in double quotes. 📝")
59+
60+
print("--------------------------------------------")
61+
62+
print("Student Activity: 🎓")
63+
64+
print("Setting Up a Developer Environment (10 mins) ⏱️")
65+
print("--------------------------------------------")
66+
67+
print("✅ **Set Up Tools:**")
68+
print("1. Install **Python 3.x** from [python.org](https://www.python.org/). 🐍")
69+
print("2. Install **Visual Studio Code** or **PyCharm Community Edition**. 💻")
70+
print("3. Install **Git** for version control ([git-scm.com](https://git-scm.com/)). 🔧")
71+
72+
print("✅ **Create a Python File:**")
73+
print("1. Open Visual Studio Code or PyCharm. 🖥️")
74+
print("2. Create a new file named `hello-world.py`. 📄")
75+
76+
print("Python Environment Ready! 🚀")
77+
78+
print("### 🧠 **Ask Students:** 🤔")
79+
80+
print("- *“What areas of development interest you most?”* 💡")
81+
print("- *“Have you ever seen a job description requiring Python skills?”* 📋")
82+
83+
print("--------------------------------------------")
84+
85+
print("✅ **Pro Tip:** 💡")
86+
87+
print("- Use Virtual Environment for Python projects. 🌐")
88+
89+
print(" python -m venv env")
90+
print(" source env/bin/activate # Mac/Linux 🐧🍎")
91+
print(" env\\Scripts\\activate # Windows 🪟")
92+
print(" deactivate # To exit the virtual environment ❌")
93+
94+
print("--------------------------------------------")
95+
print("✅ **Common Commands:** 🛠️")
96+
97+
print("- Use `pip` to install Python packages. 📦")
98+
99+
print(" pip install package-name")
100+
101+
print("- Use `pip freeze` to list installed packages. 📜")
102+
103+
print(" pip freeze")
104+
105+
print("- Use `pip install -r requirements.txt` to install packages from a file. 📂")
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os
2+
from dotenv import load_dotenv
3+
import requests
4+
5+
load_dotenv() # Load environment variables from .env file
6+
7+
def get_weather(city, api_key):
8+
base_url = "http://api.openweathermap.org/data/2.5/weather"
9+
params = {
10+
'q': city,
11+
'appid': api_key,
12+
'units': 'metric'
13+
}
14+
response = requests.get(base_url, params=params)
15+
if response.status_code == 200:
16+
data = response.json()
17+
weather = {
18+
'city': data['name'],
19+
'temperature': data['main']['temp'],
20+
'description': data['weather'][0]['description'],
21+
'humidity': data['main']['humidity'],
22+
'wind_speed': data['wind']['speed']
23+
}
24+
return weather
25+
else:
26+
return None
27+
28+
def main():
29+
api_key = os.getenv('API_KEY') # Get API key from environment variable
30+
city = input("Enter city name: ")
31+
weather = get_weather(city, api_key)
32+
if weather:
33+
print(f"City: {weather['city']}")
34+
print(f"Temperature: {weather['temperature']}°C")
35+
print(f"Weather: {weather['description']}")
36+
print(f"Humidity: {weather['humidity']}%")
37+
print(f"Wind Speed: {weather['wind_speed']} m/s")
38+
else:
39+
print("City not found or API request failed.")
40+
41+
if __name__ == "__main__":
42+
main()

0 commit comments

Comments
 (0)