From 9b0fcc5a4480c79e2c57821314c06f9f1542b45e Mon Sep 17 00:00:00 2001 From: talita Date: Tue, 14 Jul 2026 15:16:55 -0400 Subject: [PATCH 1/2] Complete Assignment 2: Warmups and Mini-Project --- week-2/assignment-2/mini_project.py | 5 +++++ week-2/assignment-2/warmup1.py | 4 ++++ week-2/assignment-2/warmup2.py | 6 ++++++ week-2/assignment-2/warmup3.py | 2 ++ week-2/assignment-2/warmup4.py | 8 ++++++++ 5 files changed, 25 insertions(+) create mode 100644 week-2/assignment-2/mini_project.py create mode 100644 week-2/assignment-2/warmup1.py create mode 100644 week-2/assignment-2/warmup2.py create mode 100644 week-2/assignment-2/warmup3.py create mode 100644 week-2/assignment-2/warmup4.py diff --git a/week-2/assignment-2/mini_project.py b/week-2/assignment-2/mini_project.py new file mode 100644 index 0000000..7c35138 --- /dev/null +++ b/week-2/assignment-2/mini_project.py @@ -0,0 +1,5 @@ +temp_input = float(input("Enter a temperature in Fahrenheit: ")) + +celsius = (temp_input - 32) * 5 / 9 + +print(f"The temperature in celsius is {celsius:.1f}") \ No newline at end of file diff --git a/week-2/assignment-2/warmup1.py b/week-2/assignment-2/warmup1.py new file mode 100644 index 0000000..2ba24a8 --- /dev/null +++ b/week-2/assignment-2/warmup1.py @@ -0,0 +1,4 @@ +# Command used: python3 warmup1.py +# Output: Python is working! + +print("Python is working!") \ No newline at end of file diff --git a/week-2/assignment-2/warmup2.py b/week-2/assignment-2/warmup2.py new file mode 100644 index 0000000..1367621 --- /dev/null +++ b/week-2/assignment-2/warmup2.py @@ -0,0 +1,6 @@ +# Commands used: mkdir {foldernames}, touch {filename.py}, cd week-2/assignment-2 + + +today_date = input("What's today's date? ") + +print(f" Today is {today_date}") \ No newline at end of file diff --git a/week-2/assignment-2/warmup3.py b/week-2/assignment-2/warmup3.py new file mode 100644 index 0000000..c1b9a4d --- /dev/null +++ b/week-2/assignment-2/warmup3.py @@ -0,0 +1,2 @@ +# git log --oneline output: +# 21a8d02 (HEAD -> assignment-2) Add warmup structure folders & designated files \ No newline at end of file diff --git a/week-2/assignment-2/warmup4.py b/week-2/assignment-2/warmup4.py new file mode 100644 index 0000000..6d39751 --- /dev/null +++ b/week-2/assignment-2/warmup4.py @@ -0,0 +1,8 @@ +# What the error message is: +# print(f"Hi, {name}") NameError: name 'name' is not defined +# What caused it: not defining the variable name before using it. +# How you fixed it: assigned a value to the variable name + +name = input("What is your name? ") + +print(f"Hi, {name}") \ No newline at end of file From 23649dfaa19c797302c0ab9df6ffc21a17c8e4ef Mon Sep 17 00:00:00 2001 From: talita Date: Tue, 28 Jul 2026 19:47:52 -0400 Subject: [PATCH 2/2] Add assignment 4: list/dict/set warmups and student roster analyzer --- week-4/assignment-4/mini_project.py | 37 +++++++++++++++++++++++++++++ week-4/assignment-4/warmup1.py | 11 +++++++++ week-4/assignment-4/warmup2.py | 12 ++++++++++ week-4/assignment-4/warmup3.py | 13 ++++++++++ 4 files changed, 73 insertions(+) create mode 100644 week-4/assignment-4/mini_project.py create mode 100644 week-4/assignment-4/warmup1.py create mode 100644 week-4/assignment-4/warmup2.py create mode 100644 week-4/assignment-4/warmup3.py diff --git a/week-4/assignment-4/mini_project.py b/week-4/assignment-4/mini_project.py new file mode 100644 index 0000000..7a68cb1 --- /dev/null +++ b/week-4/assignment-4/mini_project.py @@ -0,0 +1,37 @@ +students = [ + {"name": "Jazmine", "score": 88, "subject": "Python"}, + {"name": "Luis", "score": 74, "subject": "Data"}, + {"name": "Sara", "score": 91, "subject": "Python"}, + {"name": "Marcus", "score": 68, "subject": "Web"}, + {"name": "Priya", "score": 95, "subject": "Data"}, + {"name": "Devon", "score": 72, "subject": "Python"}, + {"name": "Mia", "score": 83, "subject": "Web"}, + {"name": "Eli", "score": 79, "subject": "Data"}, +] + +top_name = students[0]["name"] +top_score = students[0]["score"] + +for student in students: + if student["score"] > top_score: + top_score = student["score"] + top_name = student["name"] + +total_score = 0 +for student in students: + total_score += student["score"] +class_average = total_score / len(students) + +subjects_offered = set() +for student in students: + subjects_offered.add(student["subject"]) + +high_scorers = [] +for student in students: + if student["score"] > 75: + high_scorers.append(student["name"]) + +print(f'Top scorer: {top_name} ({top_score})') +print(f'Class average: {round(class_average, 1)}') +print(f'Subjects offered: {subjects_offered}') +print(f'High scorers: {high_scorers}') diff --git a/week-4/assignment-4/warmup1.py b/week-4/assignment-4/warmup1.py new file mode 100644 index 0000000..2daffbe --- /dev/null +++ b/week-4/assignment-4/warmup1.py @@ -0,0 +1,11 @@ +numbers = [12, 45, 78, 3, 91, 56, 24, 67] + +first = numbers[0] +last = numbers[-1] +middle = numbers[2:6] +reversed_numbers = numbers[::-1] + +print(f'First: {first}') +print(f'Last: {last}') +print(f'Middle: {middle}') +print(f'Reversed: {reversed_numbers}') diff --git a/week-4/assignment-4/warmup2.py b/week-4/assignment-4/warmup2.py new file mode 100644 index 0000000..5b9bbc5 --- /dev/null +++ b/week-4/assignment-4/warmup2.py @@ -0,0 +1,12 @@ +student = { + "name": "Camila", + "grade": 10, + "subjects": ["Math", "Science", "History"], +} + +for key, value in student.items(): + print(f'{key}: {value}') + +student["graduated"] = False + +print(student) diff --git a/week-4/assignment-4/warmup3.py b/week-4/assignment-4/warmup3.py new file mode 100644 index 0000000..d690860 --- /dev/null +++ b/week-4/assignment-4/warmup3.py @@ -0,0 +1,13 @@ +languages_a = ["Python", "JavaScript", "Java", "C++", "Ruby"] +languages_b = ["JavaScript", "Go", "Rust", "Python", "Swift"] + +set_a = set(languages_a) +set_b = set(languages_b) + +union = set_a | set_b +intersection = set_a & set_b +difference = set_a - set_b + +print(f'Union: {union}') +print(f'Intersection: {intersection}') +print(f'Difference: {difference}')