Part 3 - string manipulation
Extract part of the string, known as substrings, from the date and time data to give you just the date element. Store the result as a variable, keeping just the first element; you should get the result below.
03/07/2025
We want to do this programmatically, so no copy and pasting from the data, also known as “hardcoding”. This will help us to automate our code if we want to use different data.
Part 6 - start making the text output
Our ultimate task is to iterate through our temperature and date data to print out a message telling us the temperature for each hour. To get there it is sometimes helpful to breakdown the process.
Try first to a make an output for just the first hour, like the result below, using vector indexing to get the data you need. Then use string concatenation to bring all the information together to create a text output.
Temperature at 00: 16.5°C (61.7°F)
Task 7 - finish the text output
Now using the code you just wrote, iterate your code so you get the hourly weather report with both Celsius and Fahrenheit, as seen in Section 2.1.
Part 10 - test your code with new data
A good way to test out your code is to try it on different data.
Below we have the temperature data for a few days after the data we have been using. Using the steps you did previously, write a weather report using this new data.
Hourly temperatures:
20.8, 19.6, 18.7, 17.8, 17.7, 19.1, 21.4, 22.8, 24.1, 26.5, 27.8, 29.4, 30.7, 31.8, 32.4, 32.0, 31.8, 31.5, 31.2, 29.9, 28.3, 27.1, 26.2
Date and times:
"30/06/2025 01:00:00", "30/06/2025 02:00:00", "30/06/2025 03:00:00", "30/06/2025 04:00:00", "30/06/2025 05:00:00", "30/06/2025 06:00:00", "30/06/2025 07:00:00", "30/06/2025 08:00:00", "30/06/2025 09:00:00", "30/06/2025 10:00:00", "30/06/2025 11:00:00", "30/06/2025 12:00:00","30/06/2025 13:00:00", "30/06/2025 14:00:00", "30/06/2025 15:00:00", "30/06/2025 16:00:00", "30/06/2025 17:00:00", "30/06/2025 18:00:00","30/06/2025 19:00:00", "30/06/2025 20:00:00", "30/06/2025 21:00:00", "30/06/2025 22:00:00", "30/06/2025 23:00:00"