Weather Forecast Report

weather-forecastThis challenge consists of using Python to generate a random weather forecast report.

Learning Objectives:

By investigating this challenge you are going to further improve your skills at:

  • Using lists and accessing values of a list randomly,
  • Concatenating strings together to create a longer string.

What’s a list?


In Python, a list is used to save collection of values. For instance, to save a list of world cities we could declare a variable called “worldCities” and assign a list as follows:

Based on this what do you think len(worldCities) would return?
What’s about worldCities[0]?
Or worldCities[3] ?

Let’s get started!


We have started the weather forecast report for you. You will need to complete this code to provide a full weather forecast report describing:
  • What type of sky to expect: clear blue, cloudy, dark grey, etc.
  • What type of precipitations to expect: light rain, heavy snow, hail storm, fog, etc.
  • The predicted strength in mph and direction of the wind,
  • etc.


weather

Challenge #2


Create two lists of keywords, one for hot weather (e.g. hot=[“dry weather”, “hot air”, “strong sun”]) and one for cold weather (e.g. cold=[“ice on the road”,”chances of snow”, “icy wind”]).
Adapt your code to check where the temperature is high or low:

  • If your temperature is above a certain threshold add some hot weather information to your report.
  • If your temperature is below a certain threshold add some cold weather information to your report.
Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with:

Our Latest Book

Follow this blog