String = text
PYTHON
Integer = whole number
Float = decimal number
PROGRAMMING —
Boolean = True/False
LEVEL 5
DAY 2 — INPUT +
UNDERSTANDING
COMPLETE ANSWERS OUTPUT
FROM DAY 1 TO DAY 7 QUESTION:
Create Bill Calculator.
Style:
Professional beginner-to-intermediate ANSWER:
Real programmer structure # DAY 2 — BILL CALCULATOR
Readable code print("===== BILL CALCULATOR =====")
Proper naming
Logic explanation mindset # User input
item_name = input("Enter item name: ")
quantity = int(input("Enter quantity: "))
DAY 1 — VARIABLES price = float(input("Enter price per item:
"))
+ DATA TYPES # Calculations
subtotal = quantity * price
QUESTION: tax = subtotal * 0.18
Store personal information and calculate age in total = subtotal + tax
months.
# Output
ANSWER: print("\n===== RECEIPT =====")
# DAY 1 — VARIABLES AND DATA TYPES print(f"Item Name : {item_name.upper()}")
print(f"Quantity : {quantity}")
# Storing values in variables print(f"Price : Tsh {price:,.2f}")
full_name = "Joshua Petro" print(f"Subtotal : Tsh {subtotal:,.2f}")
age = 22 print(f"Tax 18% : Tsh {tax:,.2f}")
height = 1.75 print(f"Total : Tsh {total:,.2f}")
is_student = True
PROGRAMMER THINKING:
# Displaying stored values INPUT → PROCESS → OUTPUT
print("===== PERSONAL INFORMATION =====") User gives data → program calculates → results
print("Name:", full_name) displayed
print("Age:", age)
print("Height:", height)
print("Student Status:", is_student)
DAY 3 —
CONDITIONS
# Displaying data types
print("\n===== DATA TYPES =====")
print(type(full_name))
print(type(age)) QUESTION:
print(type(height)) Create Tanzania Tax Calculator.
print(type(is_student))
ANSWER:
# Calculations # DAY 3 — TANZANIA TAX CALCULATOR
age_in_months = age * 12
print("===== PAYE TAX CALCULATOR =====")
print("\n===== AGE CALCULATION =====")
print("Age in months:", age_in_months) salary = float(input("Enter monthly
PROGRAMMER THINKING: salary: "))
Variable = container # Tax calculation
if salary <= 270000:
tax = 0 counter = 1
elif salary <= 520000: while counter <= 12:
tax = (salary - 270000) * 0.08 result = number * counter
print(f"{number} x {counter} =
elif salary <= 760000: {result}")
tax = 20000 + ((salary - 520000) *
0.20) counter += 1
else: PROGRAMMER THINKING:
tax = 68000 + ((salary - 760000) * Loop = repeating instructions automatically.
0.30)
# Net salary
net_salary = salary - tax
DAY 5 — LISTS
# Income category
QUESTION:
if salary < 300000: Create Todo List Manager.
category = "Low Income" ANSWER:
# DAY 5 — TODO LIST MANAGER
elif salary <= 1000000:
category = "Middle Income"
tasks = []
else:
while True:
category = "High Income"
print("\n===== TODO MENU =====")
# Output
print("1. Add Task")
print("\n===== SALARY REPORT =====")
print("2. View Tasks")
print(f"Gross Salary : Tsh {salary:,.2f}")
print("3. Remove Task")
print(f"Tax Amount : Tsh {tax:,.2f}")
print("4. Exit")
print(f"Net Salary : Tsh
{net_salary:,.2f}")
choice = input("Choose option: ")
print(f"Category : {category}")
PROGRAMMER THINKING: # Add task
if choice == "1":
if = decision making
Computer compares conditions step-by-step. task = input("Enter task: ")
[Link](task)
DAY 4 — LOOPS print("Task added successfully!")
QUESTION: # View tasks
Create Multiplication Table Generator. elif choice == "2":
ANSWER: print("\n===== TASK LIST =====")
# DAY 4 — MULTIPLICATION TABLE
if len(tasks) == 0:
number = int(input("Enter number: ")) print("No tasks available.")
print(f"\n===== {number} TIMES TABLE else:
=====") for index, task in
enumerate(tasks, start=1):
for i in range(1, 13): print(f"{index}. {task}")
result = number * i
print(f"{number} x {i} = {result}") # Remove task
elif choice == "3":
WHILE LOOP VERSION if len(tasks) == 0:
# WHILE LOOP VERSION print("No tasks to remove.")
number = int(input("Enter number: ")) else:
for index, task in
enumerate(tasks, start=1): print("Contact added
print(f"{index}. {task}") successfully!")
remove_index = # Search contact
int(input("Enter task number to remove: elif choice == "2":
"))
search_name = input("Enter name to
if 1 <= remove_index <= search: ")
len(tasks):
removed = if search_name in phonebook:
[Link](remove_index - 1) print(f"{search_name}:
print(f"Removed: {phonebook[search_name]}")
{removed}")
else:
else: print("Contact not found.")
print("Invalid task
number.") # View contacts
elif choice == "3":
# Exit
elif choice == "4": print("\n===== CONTACTS =====")
print("Program closed.")
break if len(phonebook) == 0:
print("No contacts
else: available.")
print("Invalid option.")
else:
PROGRAMMER THINKING: for name, number in
List = storing multiple values in one place. [Link]():
print(f"{name} ->
{number}")
DAY 6 — # Delete contact
DICTIONARIES elif choice == "4":
delete_name = input("Enter contact
QUESTION: name to delete: ")
Create Phonebook Application.
if delete_name in phonebook:
ANSWER: del phonebook[delete_name]
# DAY 6 — PHONEBOOK APPLICATION print("Contact deleted.")
phonebook = {} else:
print("Contact not found.")
while True:
# Exit
print("\n===== PHONEBOOK MENU =====") elif choice == "5":
print("1. Add Contact") print("Program closed.")
print("2. Search Contact") break
print("3. View All Contacts")
print("4. Delete Contact") else:
print("5. Exit") print("Invalid option.")
choice = input("Choose option: ") PROGRAMMER THINKING:
Dictionary = key + value storage.
# Add contact Example:
if choice == "1": {
"Joshua": "0740000000"
name = input("Enter name: ") }
number = input("Enter phone
number: ")
Joshua = key
0740000000 = value
phonebook[name] = number
print(f"Title :
DAY 7 — FUNCTIONS {book['title']}")
print(f"Author :
QUESTION: {book['author']}")
print(f"Copies :
Create Library Management System. {book['copies']}")
ANSWER: found = True
# DAY 7 — LIBRARY MANAGEMENT SYSTEM
library = [] if not found:
print("Book not found.")
# Function to add book
def add_book(): # Main program loop
while True:
title = input("Enter book title: ")
author = input("Enter author: ") print("\n===== LIBRARY MENU =====")
copies = int(input("Enter number of print("1. Add Book")
copies: ")) print("2. Display Books")
print("3. Search Book")
book = { print("4. Exit")
"title": title,
"author": author, choice = input("Choose option: ")
"copies": copies
} if choice == "1":
add_book()
[Link](book)
elif choice == "2":
print("Book added successfully!") display_books()
# Function to display books elif choice == "3":
def display_books(): search_book()
print("\n===== LIBRARY BOOKS =====") elif choice == "4":
print("Program closed.")
if len(library) == 0: break
print("No books available.")
else:
else: print("Invalid option.")
for index, book in
enumerate(library, start=1):
PROGRAMMER THINKING:
Function = reusable block of code.
print(f"\nBook {index}") Instead of rewriting code:
print(f"Title : print("Hello")
{book['title']}") many times…
print(f"Author : You create:
{book['author']}") def greet():
print(f"Copies : print("Hello")
{book['copies']}")
Then call:
# Function to search books greet()
def search_book():
keyword = input("Enter book title: ")
found = False
for book in library:
if [Link]() in
book["title"].lower():
print("\nBook Found!")
FINAL
PROGRAMMER
LESSONS
1. GOOD PROGRAMMERS
THINK IN STEPS
Always ask:
Input?
Process?
Output?
2. ERRORS ARE NORMAL
Common errors:
SyntaxError
NameError
TypeError
IndentationError
3. WRITE CODE DAILY
Even:
20 lines,
50 lines,
100 lines daily
builds skill fast.
4. READ YOUR OWN CODE
Real growth starts when:
you understand every line,
not when code runs only.
5. MASTER THESE FIRST
Before advanced programming:
variables
loops
conditions
functions
lists
dictionaries
debugging
These are the REAL foundation.