Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7a86d2c
Fixed quote on 5
Apr 28, 2025
f04e70f
Lecture 7 Music + Sports String Data Challenge
Apr 30, 2025
0b94f04
Completed Data Challenges
Apr 30, 2025
b20cebb
Finished Lecture 9 challenges
May 6, 2025
d2155f9
Retreived data challenge
Jun 3, 2025
40aedd3
Completed Data Challenge
Jun 3, 2025
7396289
completed data challenge
Jun 3, 2025
c634e55
Merge remote-tracking branch 'upstream/main' into debo
Jun 4, 2025
a1c47ae
Both finished data challenges
Jun 4, 2025
f3c984b
Merge pull request #2 from The-Marcy-Lab-School/main
debood Jun 5, 2025
d8de518
Added M1L4 CCs
Jun 5, 2025
19618cc
Pulled DC 5 & 6
Jun 10, 2025
8d0e641
Pulled DC 7
Jun 11, 2025
f4f79e5
added work i was behind
Jun 17, 2025
f625e0b
mod 2
Jul 7, 2025
13e6b99
finished M2 DC 8
Jul 7, 2025
f4fed6f
Finished M2 DC 9
Jul 8, 2025
86d13b9
Merge remote-tracking branch 'upstream/main' into debo
Jul 9, 2025
8c8f4b0
DC 10
Jul 9, 2025
2fa0712
pulled M2 DC11
Jul 10, 2025
cb31d99
M2 DC 11
Jul 10, 2025
069bda6
livelab 12
Jul 14, 2025
0d1beb5
Getting Mod5
Oct 1, 2025
63157bd
Added first 3 data challenges
Oct 1, 2025
d8112cd
fetching dc 4
Oct 2, 2025
ed99fd5
dc 5'
Oct 6, 2025
eedeeb6
dc 6
Oct 7, 2025
e1a9f35
dc 7
Oct 8, 2025
207a91d
completed mod 5 dc
Oct 9, 2025
e379749
pulled dc
Oct 27, 2025
c17f369
pulled dc
Oct 28, 2025
3458db2
pulled dc
Nov 3, 2025
46cc805
pulled
Nov 10, 2025
086d947
pulled
Nov 12, 2025
6656791
added dc 4
Nov 13, 2025
9d1a043
added dc 5
Nov 13, 2025
13c5819
pulled dc
Nov 18, 2025
b98265f
data challenges mod 6 DC 6-12
Nov 18, 2025
8347b10
pulled dc up to 20
Dec 1, 2025
c120057
pulled dc 21
Dec 2, 2025
ca28445
save before merge
Dec 3, 2025
aa6e61e
pulled dc 22
Dec 3, 2025
d65b0b1
caught up to dc
Dec 3, 2025
49c55fd
removed accidental files
Dec 3, 2025
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
140 changes: 106 additions & 34 deletions Mod0/CodeChallenges/Lecture7CC.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 169,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Team Name: Celtics\n",
"Sport: Basketball\n",
"Number of Players: 17\n",
"Team Captain: Jaylen Brown, Jayson Tatum, or Al Horford\n"
]
}
],
"source": [
"# Assign the variables\n",
"team_name = None # Replace None with the team name\n",
"sport = None # Replace None with the sport\n",
"num_players = None # Replace None with the number of players\n",
"team_captain = None # Replace None with the team captain's name\n",
"team_name = \"Celtics\" # Replace None with the team name\n",
"sport = \"Basketball\" # Replace None with the sport\n",
"num_players = 17 # Replace None with the number of players\n",
"team_captain = \"Jaylen Brown, Jayson Tatum, or Al Horford\" # Replace None with the team captain's name\n",
"\n",
"# Print the variables\n",
"print(\"Team Name:\", team_name)\n",
Expand Down Expand Up @@ -88,18 +99,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 66,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Uppercase Team Name: CELTICS\n",
"Does the captain's name contain 'a'? Yes!\n",
"Updated Sport Name: Hoops\n"
]
}
],
"source": [
"# String manipulations\n",
"uppercase_team_name = None # Convert the team name to uppercase\n",
"contains_a = None # Check if the captain's name contains the letter \"a\"\n",
"new_sport = None # Replace \"Basketball\" with \"Hoops\"\n",
"uppercase_team_name = str.upper(team_name) # Convert the team name to uppercase\n",
" try:\n",
" contains_a = team_captain.index(\"a\")\n",
" if contains_a > 0:\n",
" yesno= \"Yes!\"\n",
"except ValueError:\n",
" yesno = \"No.\" # Check if the captain's name contains the letter \"a\"\n",
"new_sport = sport.replace(\"Basketball\",\"Hoops\") # Replace \"Basketball\" with \"Hoops\"\n",
"\n",
"# Print the results\n",
"print(\"Uppercase Team Name:\", uppercase_team_name)\n",
"print(\"Does the captain's name contain 'a'?\", contains_a)\n",
"print(\"Does the captain's name contain 'a'? \", yesno)\n",
"print(\"Updated Sport Name:\", new_sport)"
]
},
Expand All @@ -124,19 +150,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 170,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Players List: ['Jaylen Brown', 'Torrey Craig', 'JD Davison', 'Sam Hauser', 'Jrue Holiday', 'Al Horford', 'Luke Kornet', 'Miles Norris', 'Drew Peterson', 'Kristaps Porziņģis', 'Payton Pritchard', 'Neemias Queta', 'Baylor Scheierman', 'Jayson Tatum', 'Xavier Tillman', 'Jordan Walsh', 'Derrick White', 'Debo Odutola']\n",
"First Player: Jaylen Brown\n",
"Last Player: Derrick White\n"
]
}
],
"source": [
"# Create a list of players\n",
"players = None # Replace None with a list of player names\n",
"players = [\"Jaylen Brown\", \"Torrey Craig\", \"JD Davison\", \"Sam Hauser\", \"Jrue Holiday\", \"Al Horford\", \"Luke Kornet\", \"Miles Norris\", \"Drew Peterson\", \"Kristaps Porziņģis\", \"Payton Pritchard\", \"Neemias Queta\", \"Baylor Scheierman\", \"Jayson Tatum\", \"Xavier Tillman\", \"Jordan Walsh\", \"Derrick White\"] # Replace None with a list of player names\n",
"\n",
"# Access the first and last players\n",
"first_player = None # Access the first player\n",
"last_player = None # Access the last player\n",
"first_player = players[0] # Access the first player\n",
"last_player = players[-1] # Access the last player\n",
"\n",
"# Add a new player to the list\n",
"players.append(None) # Add \"Jamie Carter\"\n",
"players.append(\"Debo Odutola\") # Add \"Jamie Carter\" (Adding myself instead)\n",
"\n",
"\n",
"# Print the results\n",
"print(\"Players List:\", players)\n",
Expand Down Expand Up @@ -165,23 +202,41 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 171,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Team Info: {'Team Name': 'Celtics', 'Sport': 'Basketball', 'Players': ['Jaylen Brown', 'Torrey Craig', 'JD Davison', 'Sam Hauser', 'Jrue Holiday', 'Al Horford', 'Luke Kornet', 'Miles Norris', 'Drew Peterson', 'Kristaps Porziņģis', 'Payton Pritchard', 'Neemias Queta', 'Baylor Scheierman', 'Jayson Tatum', 'Xavier Tillman', 'Jordan Walsh', 'Derrick White', 'Debo Odutola'], 'Positions': ['Point Guard', 'Shooting Guard', 'Small Forward', 'Power Forward', 'Center']}\n",
"Position of Second Player: Shooting Guard\n",
"Number of Guards: 2\n"
]
}
],
"source": [
"# Create a dictionary\n",
"team_info = {\n",
" \"Team Name\": None, # Replace None with the team name\n",
" \"Sport\": None, # Replace None with the sport\n",
" \"Players\": None, # Replace None with the list of players\n",
" \"Positions\": None # Replace None with the list of positions\n",
" \"Team Name\": \"Celtics\", # Replace None with the team name\n",
" \"Sport\": \"Basketball\", # Replace None with the sport\n",
" \"Players\": players, # Replace None with the list of players\n",
" \"Positions\": [\"Point Guard\", \"Shooting Guard\", \"Small Forward\", \"Power Forward\", \"Center\"] # Replace None with the list of positions\n",
"}\n",
"\n",
"# Access the position of the second player\n",
"second_player_position = None # Access the second position\n",
"second_player_position = team_info[\"Positions\"][1] # Access the second position\n",
"\n",
"# Count the number of \"Guards\"\n",
"guard_count = None # Count how many times \"Guard\" appears in the positions list\n",
"i = 0\n",
"guard_count = 0\n",
"for i in range(len(team_info[\"Positions\"])):\n",
" position = team_info[\"Positions\"][i]\n",
" if position.find(\"Guard\") > 0:\n",
" guard_count += 1\n",
" \n",
"\n",
" # Count how many times \"Guard\" appears in the positions list\n",
"\n",
"# Print the results\n",
"print(\"Team Info:\", team_info)\n",
Expand All @@ -206,18 +261,35 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 173,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Total Players: 18\n",
"Unique Positions: 5\n",
"Is Jordan Smith the Captain? No\n"
]
}
],
"source": [
"# Calculate the number of players\n",
"total_players = None # Use the len() function to calculate the number of players\n",
"total_players = len(players) # Use the len() function to calculate the number of players\n",
"\n",
"# Calculate the number of unique positions\n",
"unique_positions = None # Use the set() function to find unique positions\n",
"\n",
"unique_positions = len(set(\"Positions\")) - 1 # Use the set() function to find unique positions\n",
"\n",
"# Check if \"Jordan Smith\" is the team captain\n",
"is_captain = None # Use a comparison to check if \"Jordan Smith\" is the captain\n",
"\n",
"if team_captain == \"Jordan Smith\":\n",
" is_captain = \"Yes\"\n",
"else:\n",
" is_captain = \"No\"\n",
"\n",
" # Use a comparison to check if \"Jordan Smith\" is the captain\n",
"\n",
"# Print the results\n",
"print(\"Total Players:\", total_players)\n",
Expand Down Expand Up @@ -254,9 +326,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python (learn-env)",
"display_name": "Python 3",
"language": "python",
"name": "learn-env"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -268,7 +340,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
89 changes: 62 additions & 27 deletions Mod0/CodeChallenges/Lecture9CC.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -78,29 +78,40 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Import the JSON module\n",
"None"
"import json"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 41,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Movie Titles: Inception\n",
"Movie Titles: The Dark Knight\n",
"Movie Titles: Interstellar\n",
"Movie Titles: The Godfather\n"
]
}
],
"source": [
"# Step 1: Extract Movie Titles\n",
"# Write a loop to extract and print the titles of all movies\n",
"for movie in None:\n",
" print(\"Movie Titles:\")"
"for movie in data[\"movies\"]:\n",
" print(\"Movie Titles:\", movie[\"title\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 47,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -110,17 +121,25 @@
"\n",
"def find_movies_by_genre(genre):\n",
" movies_in_genre = []\n",
" for movie in None:\n",
" if None:\n",
" movies_in_genre.append(None)\n",
" for movie in data[\"movies\"]:\n",
" if genre == movie['genre']:\n",
" movies_in_genre.append(movie[\"title\"])\n",
" return movies_in_genre"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 48,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Inception', 'Interstellar']\n"
]
}
],
"source": [
"# Test the function run this cell without changes\n",
"genre = \"Sci-Fi\"\n",
Expand All @@ -130,45 +149,61 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 54,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Average IMDb Rating: 8.9\n"
]
}
],
"source": [
"# Step 3: Calculate Average IMDb Rating\n",
"# Write a loop to calculate the average IMDb rating of all movies\n",
"# Replace this with a loop to calculate the total IMDb rating and count of movies\n",
"total_rating = 0\n",
"movie_count = 0\n",
"for movie in None:\n",
" total_rating += movie[\"ratings\"][\"IMDB\"] \n",
"for movie in data['movies']:\n",
" total_rating += movie[\"ratings\"][\"IMDb\"] \n",
" movie_count += 1\n",
"average_rating = None # Replace this with the formula to calculate the average\n",
"print(\"Average IMDb Rating:\", average_rating)"
"average_rating = total_rating/movie_count # Replace this with the formula to calculate the average\n",
"print(\"Average IMDb Rating:\", round(average_rating,2))"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 59,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Highest Rated Movie (IMDb): The Godfather\n"
]
}
],
"source": [
"# Step 4: Find the Highest Rated Movie (IMDb)\n",
"# Write a loop to find the movie with the highest IMDb rating\n",
"# Replace this with a loop to find the highest-rated movie\n",
"highest_rating = 0\n",
"for movie in None:\n",
" if movie[\"ratings\"][\"IMDb\"] > None:\n",
"for movie in data['movies']:\n",
" if movie[\"ratings\"][\"IMDb\"] > highest_rating:\n",
" highest_rating = movie[\"ratings\"][\"IMDb\"]\n",
" highest_rated_movie = None\n",
" highest_rated_movie = movie['title']\n",
"print(\"Highest Rated Movie (IMDb):\", highest_rated_movie)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (learn-env)",
"display_name": "Python 3",
"language": "python",
"name": "learn-env"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -180,7 +215,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down
Loading