Back to teaching portfolio

Course Detail

CSBP121 · Programming Lab I

Studio-style labs convert CSBP119 theory into applied fluency through structured practice, debugging routines, and guided assessments.

Credits
1 credit hour
Contact Hours
One 2h30 lab per week
Prerequisite
None
Co-requisite
CSBP119

Section Information

Lab Instructor

AbdalRaheem Al Smadi
afalsmadi@uaeu.ac.ae
Office: E1, Floor 3, Room 3040
Office Hours: Announced on Blackboard

Schedule & Coordinator

Labs and coordinator details are published on E-Services and Blackboard announcements.

Catalogue Description

Lab assignments and projects help students master structured programming concepts: problem-solving, simple and structured data types, input/output, selection, repetition, and methods.

Textbook & Learning Resources

Teaching & Learning Methodologies

Course Learning Outcomes

  1. Design and implement algorithms to solve simple problems.
  2. Choose appropriate data types to represent information.
  3. Apply sequence, selection, and repetition structures.
  4. Design and implement multi-method programs.
  5. Manipulate one- and two-dimensional arrays.

Topical Outline

Week Topic(s) CLOs Methods
Week 1 Lab0: Introduction and installation CLO1 Problem Based Learning
Week 2 Lab1: Pseudocode & flowcharts (Ch.2) CLO1 Problem Based Learning
Week 3 Lab2: Simple programs, debugging (Ch.2) CLO1 Problem Based Learning
Week 4 Lab3: Algorithm tracing (Ch.2) CLO1, CLO2 Problem Based Learning
Week 5 Lab4: Decision structures (Ch.3) CLO1, CLO3 Problem Based Learning
Week 6 Lab5: Repetition structures (Ch.4) CLO1, CLO3 Problem Based Learning
Week 7 Lab Quiz 1 / Lab6: Repetition practice CLO3 Problem Based Learning
Week 8 Lab7: Math module CLO1, CLO3 Problem Based Learning
Week 10 Lab8: Predefined and user-defined methods CLO1, CLO3 Problem Based Learning
Week 11 Lab Quiz 2 / Lab10: One-dimensional lists CLO1, CLO3 Problem Based Learning
Week 12 Lab11: Two-dimensional lists & tuples CLO4, CLO5 Problem Based Learning
Week 13 Lab12: Strings CLO4, CLO5 Problem Based Learning
Week 14 Lab9: File I/O CLO1, CLO4 Problem Based Learning

Lab Modules Overview

Labs align one-to-one with the topical outline.

Lab Focus Linked Week
Lab0Orientation & installationWeek 1
Lab1Pseudocode & flowchartsWeek 2
Lab2Basic programs & debuggingWeek 3
Lab3Tracing algorithmsWeek 4
Lab4Decision structuresWeek 5
Lab5Repetition structuresWeek 6
Lab6Repetition quiz & reinforcementWeek 7
Lab7Math module practiceWeek 8
Lab8Methods practiceWeek 10
Lab9File I/OWeek 14
Lab10One-dimensional listsWeek 11
Lab11Two-dimensional lists & tuplesWeek 12
Lab12StringsWeek 13

Lab0 · Orientation & Installation

Set up the tools and build confidence navigating the lab environment.

Problem: Environment Checklist

Collect configuration details and print a launch checklist.

ide = input("IDE installed (y/n): ").strip().lower()
python = input("Python installed (y/n): ").strip().lower()
git = input("Git installed (y/n): ").strip().lower()

print("Environment Checklist")
print("IDE ready:", ide == "y")
print("Python ready:", python == "y")
print("Git ready:", git == "y")

Problem: Version Banner

Simulate version prompts without calling system commands.

py_version = "3.12.0"
pycharm_version = "2024.1"

print("Python version:", py_version)
print("PyCharm version:", pycharm_version)

Lab1 · Pseudocode & Flowcharts

Translate problem statements into structured pseudocode and simple console I/O.

Problem: Campus Greeting

Use pseudocode to greet a user and collect their major.

name = input("Enter your name: ")
major = input("Enter your major: ")

print("Welcome", name)
print("Major:", major)

Problem: Step Counter

Prompt for steps and convert to kilometers.

steps = int(input("Steps walked today: "))
meters = steps * 0.8
kilometers = meters / 1000
print("Distance:", round(kilometers, 2), "km")

Lab2 · Simple Programs & Debugging

Write small programs and correct syntax/logical mistakes.

Problem: Syntax Fixer

Fix the provided snippet and print the sum of two integers.

first = int(input("First number: "))
second = int(input("Second number: "))
result = first + second
print("Sum =", result)

Problem: Conversion Debug

Read Celsius and convert to Fahrenheit with correct math.

celsius = float(input("Temperature °C: "))
fahrenheit = celsius * 9 / 5 + 32
print("Fahrenheit:", round(fahrenheit, 1))

Lab3 · Tracing Algorithms

Trace intermediate values and match pseudocode to output.

Problem: Savings Trace

Track monthly savings and display status each month.

target = 500
balance = 0
month = 1

while balance < target:
    deposit = int(input("Month " + str(month) + " deposit: "))
    balance += deposit
    print("Balance after month", month, "=", balance)
    month += 1

Problem: Counter Walkthrough

Simulate a simple counter loop and show the trace.

counter = 0
limit = int(input("Loop until: "))
while counter <= limit:
    print("Counter:", counter)
    counter += 1

Lab4 · Decision Structures

Apply if/elif/else logic to real-world checkpoints.

Problem: Access Badge Check

Grant or deny lab entry based on badge type.

badge = input("Badge type (student/faculty/staff): ").strip().lower()
if badge == "faculty":
    print("Access granted to all labs")
elif badge == "staff":
    print("Access granted to support labs")
else:
    print("Access granted to student labs only")

Problem: GPA Eligibility

Check if a student qualifies for lab leadership.

gpa = float(input("Current GPA: "))
hours = int(input("Completed credits: "))

if gpa >= 3.0 and hours >= 30:
    print("Eligible for lab leadership role")
else:
    print("Keep building your portfolio")

Lab5 · Repetition Structures

Practice while and for loops to automate tasks.

Problem: Password Attempts

Allow up to three password tries.

attempts = 0
secret = "uaeu"

while attempts < 3:
    guess = input("Password: ")
    if guess == secret:
        print("Welcome!")
        break
    attempts += 1

if attempts == 3:
    print("Account locked")

Problem: Multiples List

Print the first ten multiples of a number.

number = int(input("Number: "))
count = 1
while count <= 10:
    print(number, "x", count, "=", number * count)
    count += 1

Lab6 · Repetition Quiz

Reinforce loop comfort with sentinel-controlled labs.

Problem: Average Calculator

Read integers until -1 and compute the average.

total = 0
count = 0
value = int(input("Enter a number (-1 to stop): "))

while value != -1:
    total += value
    count += 1
    value = int(input("Enter a number (-1 to stop): "))

if count > 0:
    print("Average:", total / count)
else:
    print("No values entered")

Problem: Countdown Timer

Countdown from a user-specified number.

start = int(input("Countdown start: "))

while start >= 0:
    print(start)
    start -= 1

Lab7 · Math Module Practice

Combine math helpers and built-in functions.

Problem: Ceiling Calculator

Compute how many boxes are needed for supplies.

import math

items = int(input("Items to pack: "))
box_size = int(input("Items per box: "))

boxes = math.ceil(items / box_size)
print("Boxes required:", boxes)

Problem: Hypotenuse Helper

Use math.sqrt to compute triangle hypotenuse.

import math

a = float(input("Side a: "))
b = float(input("Side b: "))
hyp = math.sqrt(a * a + b * b)
print("Hypotenuse =", round(hyp, 2))

Lab8 · Methods Practice

Encapsulate logic in reusable functions.

Problem: Greeting Function

Define a function that returns a greeting string.

def greet(name):
    message = "Hello " + name
    return message

user = input("Name: ")
print(greet(user))

Problem: Score Normalizer

Use a helper function to clamp scores between 0 and 100.

def clamp_score(score):
    if score < 0:
        return 0
    if score > 100:
        return 100
    return score

raw = int(input("Score: "))
print("Normalized:", clamp_score(raw))

Lab9 · File I/O

Practice reading and writing text files with clear messaging.

Problem: Read Schedule

Display lines from schedule.txt if present.

try:
    with open("schedule.txt", "r", encoding="utf-8") as file:
        for line in file:
            cleaned = line.strip()
            if cleaned:
                print(cleaned)
except FileNotFoundError:
    print("schedule.txt not found")

Problem: Append Notes

Write a single-line note to lab_notes.txt.

note = input("Lab note: ").strip()

try:
    with open("lab_notes.txt", "a", encoding="utf-8") as file:
        file.write(note + "\n")
    print("Note saved.")
except OSError as error:
    print("Could not save note:", error)

Lab10 · One-Dimensional Lists

Manipulate simple collections of values.

Problem: Sum of Scores

Build a list from user entries and calculate the total.

scores = []
count = int(input("How many scores? "))
index = 0
while index < count:
    score = float(input("Score: "))
    scores.append(score)
    index += 1

total = 0
for value in scores:
    total += value

print("Total:", total)

Problem: Max Finder

Find the largest number in a list.

numbers = [12, 5, 19, 3]
largest = numbers[0]
for value in numbers:
    if value > largest:
        largest = value
print("Largest:", largest)

Lab11 · Two-Dimensional Lists & Tuples

Represent grids and coordinate data using nested structures.

Problem: Seating Chart

Iterate through a 2D list and print row/seat assignments.

seats = [
    ["S1", "S2"],
    ["S3", "S4"]
]

row_index = 0
while row_index < len(seats):
    seat_index = 0
    while seat_index < len(seats[row_index]):
        print("Row", row_index, "Seat", seats[row_index][seat_index])
        seat_index += 1
    row_index += 1

Problem: Tuple Coordinates

Store points as tuples and print them.

points = [(2, 3), (4, 1), (0, 0)]
for point in points:
    print("Point:", point[0], point[1])

Lab12 · Strings

Perform string parsing and reporting.

Problem: Word Counter

Count words in a sentence using split().

sentence = input("Enter a sentence: ").strip()
words = sentence.split()
print("Word count:", len(words))

Problem: Case Toggle

Flip lowercase/uppercase characters manually.

text = input("Text: ")
converted = ""
index = 0
while index < len(text):
    char = text[index]
    if char.islower():
        converted += char.upper()
    else:
        converted += char.lower()
    index += 1
print(converted)