Canvas → Assignments → Assignment2 Assignment 2 Define your own function based on “real” python with at least one loop (for or while) and if statements. Please avoid choosing what you already learn
Canvas Assignments Assignment2 Assignment 2 Define your own function based on “real” python with at least one loop (for or while) and if statements. Please avoid choosing what you already learn, but something new! For example, a special recipe, vending machine, something related to climate/weather… unleashes your creativity! Amount: Don’t have any limitations (file format: PDF, not ipynb, convert from ipynb to PDF), Rule: you need to include “if” and loop (“for” or “while”) statements Due: of March Hint: Lottery number generator and temp24 function in Lecture 3
Expert Answer
This solution was written by a subject matter expert. It’s designed to help students like you learn core concepts.
1st step
All steps
Answer only
Step 1/3
There are a few issues with the provided code. First, the function name has a space in it which will result in a syntax error. It should be changed to
generate_weather_forecast. Second, the dictionary temperatures has incorrect formatting as it is missing a colon after the key “snowy”. It should be {'sunny': (60, 90), 'cloudy': (50, 70), 'rainy': (40, 60), 'snowy': (20, 40)}. Finally, the line that defines the forecast string is missing an f before the string, which is necessary to include the value of the location parameter in the output.Explanation:
Your code has some issues that are explained above please check it
OR