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:

worldCities = ["London", "Sao Paulo", "New-York", "Beijing", "Paris", "Cairo", "Dehli"]

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.

Did you like this challenge?

Click on a star to rate it!

Average rating 4 / 5. Vote count: 4

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: