•
☑Kizspy.me:
Each question asks you to write a Python program or function.
Submit a .py file with your solutions.
Do not use Al tools or the internet. Your work must be your own.
Zoom
Given file: A file named berlin_14day_weather.json has been given to you. It contains 14
days of weather forecast data for Berlin, Germany.
Question 1. Read File & Print Info(1.5 mark)
You must read the file using the Python json module and then, then print the latitude,
longitude, elevation, and timezone of the weather location.
Question 2. Find Max Fluctuation Day(1 mark)
•
A temperature fluctuation is the difference between a day's maximum and minimum
temperatures. Write a function to calculate the temperature fluctuation for each day,
and print the date with the highest fluctuation and the fluctuation value.
Question 3. Find Cold Days(1 mark)
• Write a function to find and print all dates where the maximum temperature is less
than 15°C; return the list of these cold days.
Question 4: Export Cold Days to CSV(1.5 mark)
• Using the list of cold days from Question 3, write a function to save the results into a
file named cold_days.csv. The file must include a header row with the columns: date,
max_temp, min_temp, and each row should contain the corresponding data for one
cold day.
Question 5. Create and Fill SQLite Database(1.5 mark)
• Create a SQLite database named weather.db and define a table called
weather forecast with the following columns: id (INTEGER, PRIMARY KEY,
AUTOINCREMENT), date (TEXT), max_temp (REAL), min_temp (REAL), and
fluctuation (REAL). Then, write a Python program to insert all 14 days of weather
data into this table. The fluctuation should be calculated in Python before insertion.
Question 6. Query Cold Nights from Database(1 mark)
• Write a SQL query using Python to retrieve and print all days from the table where
the minimum temperature is below 9°C.
Question 7: Generate Weather Summary Report(1.5 marks)
• Write a function to display a weather summary that calculates and prints the average
max temperature, average min temperature, number of cold days (max_temp < 15),
number of cold nights (min_temp <9), and the full temperature range (highest max -
lowest min).
Question 8: Plot Temperature Trends (1 mark)
Using matplotlib, draw a line chart that shows the max and min temperatures over
the 14-day period, with proper labels, title, and legend.
+100%
Close