Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions week-2/assignment-2/mini_project.py
Original file line number Diff line number Diff line change
@@ -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}")
4 changes: 4 additions & 0 deletions week-2/assignment-2/warmup1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Command used: python3 warmup1.py
# Output: Python is working!

print("Python is working!")
6 changes: 6 additions & 0 deletions week-2/assignment-2/warmup2.py
Original file line number Diff line number Diff line change
@@ -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}")
2 changes: 2 additions & 0 deletions week-2/assignment-2/warmup3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# git log --oneline output:
# 21a8d02 (HEAD -> assignment-2) Add warmup structure folders & designated files
8 changes: 8 additions & 0 deletions week-2/assignment-2/warmup4.py
Original file line number Diff line number Diff line change
@@ -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}")
37 changes: 37 additions & 0 deletions week-4/assignment-4/mini_project.py
Original file line number Diff line number Diff line change
@@ -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}')
11 changes: 11 additions & 0 deletions week-4/assignment-4/warmup1.py
Original file line number Diff line number Diff line change
@@ -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}')
12 changes: 12 additions & 0 deletions week-4/assignment-4/warmup2.py
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 13 additions & 0 deletions week-4/assignment-4/warmup3.py
Original file line number Diff line number Diff line change
@@ -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}')