β Week 01 Lab Solutions
![Image representing data transformation and discovery themes.](../../../../figures/visual-identity/2024_2025_DS105W_icon_200px.png)
Last Updated: 27 January 2025
Parts I, II, and III of the π» W01 Lab were designed so that you would attempt them by using the knowledge you got from the DataQuest lessons we asked you to take last week plus new concepts that were introduced in class by your class teacher. I gave them the freedom to choose how they want to go about the solutions, according to the dynamics of the classroom and here I bring together some of their solutions as well as my own step-by-step guide to think about the Take-Home exercise based on Riyaβs solution to her class group.
π₯ Download Solutions
Class teachers Riya and Barry have shared their own versions of the full notebook with the lab solutions. As there are always multiple ways to solve a problem, it might be worth conmparing your solution with theirs.
You can download the notebooks below:
Stuart also wrote a message and shared it on the #class-group-4
channel:
Click to read Stuartβs message
As promised, here is how you can answer part 3.1 using a for loop. You should be able to replicate this code chunk as is. In particular, check out how i substitutes for the 1st, 2nd and 3rd element in each list. As mentioned, I renamed all the lists inside the for loop as typing them inside the f-string makes it overly long.
= 9
cold_threshold = [8,8,10]
london_forecast_max = [1,0,3]
london_forecast_min = ["π§οΈ","π§οΈ","βοΈ"]
london_forecast_conditions = ["Wed, 22 Jan 2025","Thu, 23 Jan 2025","Fri, 24 Jan 2025"]
date
print("FORECAST\n=========================================\n")
for i in range(0,3):
# Parameters
= date
dates = london_forecast_conditions
emojis = london_forecast_min
mins = london_forecast_max
maxes
# String concatenation
= f"{dates[i]} - {emojis[i]} Min: {mins[i]}Β°C, Max: {maxes[i]}Β°C"
london_forecast_summary
# If-Else statement
if london_forecast_max[i] < cold_threshold:
print(f"{london_forecast_summary}*")
else:
print(london_forecast_summary)
print("...")
See you next Friday, Stuart
π Take-Home Exercise
The solution to the Take-Home Exercise was embedded into the π W02 Formative Exercise. Take a look at the solution over there and donβt forget to take the listed DataQuest lessons!