๐ป Week 01 Lab
Interactive Python Practice in Nuvolos
print()
function to display and format output.
Last Updated: 21 January 2025, 18:30 GMT
๐Time and Location: Friday, 24 January 2025 at KSW.2.10. Check your timetable for the precise time of your class.
๐ Preparation
Before your first lab session, choose one of the options below to set up your Python environment on Nuvolos or locally (if youโre feeling particularly brave).
Nuvolos Setup (Recommended)
Follow the Nuvolos First Time Access Guide.
Log in to Nuvolos, then click on the Applications tab on the left.
Turn on the VS Code application by pressing the button and wait for it to load. During your first launch, youโll see a welcome screen. Choose a colour scheme and mark the tutorials as done.
โ ๏ธ Note: The notebook was only tested on light colour schemes.
Open the folder โWeek 01 - Python Basics/โ and click on
W01 Lab - Python Basics.ipynb
. This will open the notebook in a new tab inside VS Code. Follow along with the notebook and execute code cells as you go.
If for some random reason the notebook isnโt available in your Nuvolos environment, you can download it from the link below and upload it to your Nuvolos environment:
Run On Your Own Laptop (ONLY FOR THE BRAVEST STUDENTS โ NOT RECOMMENDED)
โ ๏ธ WARNING: Setting up a local environment isnโt straightforward. Unlike the apps you install from the App Store, coding setups can throw unexpected errors that even instructors might struggle to debug. We highly recommend using Nuvolos at the start of the course. Weโll help you set up your laptop later with more time.
Choose this path only if you feel fully confident in your ability to install software and resolve potential issues independently.
Steps for Local Setup:
Download and install Anaconda for your operating system (you can skip the registration part). Let it install everything it wants to install.
Download and install VS Code. This should be more straightforward.
Create a dedicated folder on your computer โ NOT on your desktop โ for this course. Call it
DS105W
or something similar.Under this folder, create a new folder called
Week 01 - Python Basics
.Download the lab notebook and place it inside the
Week 01 - Python Basics
folder.Open VS Code, then go to File > Open Folder and select the
DS105W
folder you created.You should see the following structure:
DS105W/ โโโ Week 01 - Python Basics/ โ โโโ W01 Lab - Python Basics.ipynb
Open the notebook by double-clicking on
W01 Lab - Python Basics.ipynb
.
Youโre all set! Letโs get started with the lab.
๐ฃ๏ธ Lab Roadmap
Part I: Welcome, Setup, and Python Basics (20 min)
Note to class teachers: Begin by introducing yourself and outlining the session objectives. Guide students through the setup process on Nuvolos or assist those troubleshooting local installations. Once everyone is set up, proceed with a hands-on introduction to Jupyter Notebooks.
๐ง๐ปโ๐ซ TEACHING MOMENT
Give your full attention to your class teacher! They will guide you through the initial tasks on Part I of the notebook.
At the end, you should be able to use the skills you learned during the DataQuest lessons from the ๐ W01 Formative Exercise and accomplish the following tasks:
- Input and print Londonโs current temperature (
london_current_temp
). - Write an
if/else
statement to compare against a personalcold_threshold
variable.
Part II: Working with Lists (30 min)
Note to class teachers: Encourage students to work independently on this section. Circulate the room, offering assistance as needed. Suggest they collaborate and support each other if stuck. At the end of the allocated time, gather their attention for a live solution walkthrough.
๐ฏ ACTION POINTS
Using Part II of the notebook, complete the following:
- Create lists for:
- Daily maximum temperatures (
london_forecast_max
). - Daily minimum temperatures (
london_forecast_min
). - Daily weather conditions (
london_forecast_conditions
).
- Daily maximum temperatures (
- Write code to:
- Access specific elements, such as todayโs and tomorrowโs weather.
- Format and print a simple two-day forecast, including max and min temperatures and conditions.
๐ง๐ปโ๐ซ TEACHING MOMENT
At the end of this section, your class teacher will:
- Live-code the solution on screen.
- Explain any advanced concepts, like indexing or list slicing, used in their solution.
- Share their final notebook version on Slack for reference.
Part III: Day-by-Day and Weekly Summary (40 min)
Note to class teachers: Encourage students to work independently or in small groups. Toward the end of the session, gather everyone for a live walkthrough of a solution. You can either stick to the weekโs core practices or introduce more advanced techniques (e.g., loops, f-strings) based on the classโs progress and engagement. Adapt your approach as needed to match the roomโs energy and understanding.
๐ฏ ACTION POINTS
Complete the tasks in Part III of the notebook:
- Write code to display:
- A day-by-day summary showing the day of the week, min and max temperatures, and weather condition.
- Use an asterisk (*) to mark days where the max temperature is below your
cold_threshold
.
- Write a weekly summary showing:
- Average high and low temperatures.
- The temperature range for the week.
๐ง๐ปโ๐ซ TEACHING MOMENT
During the final demonstration, your class teacher may:
- Highlight techniques for improving efficiency, such as
for
loops. - Show you the power of special characters like
\t
and\n
for formatting output. - Give you tips on how to format strings dynamically with f-strings.
- Explain the importance of clean and readable code.
๐ก Take-Home Exercise: Multi-City Analysis
This weekโs take-home exercise will extend your learning by comparing Londonโs forecast with another cityโs forecast.
๐ก TIP: This activity will help you practice the skills you learned in the lab and reinforce your understanding of Python basics and it will be the starting point for the ๐ W02 Formative Exercise 1.
๐ฏ ACTION POINTS
Extend your learning by completing the optional take-home exercise in Part IV of the notebook, which includes the following tasks:
- Create lists for another cityโs forecast (e.g., Paris):
- Max and min temperatures.
- Weather conditions.
- Compare London and the other city:
- Format a side-by-side daily forecast for both cities.
- Write a weekly summary for each city.
Footnotes
link not yet availableโฉ๏ธ