Question: Write a Python program that does the following specified tasks based on user input: 1 . The user inputs the name of a region in
Write a Python program that does the following specified tasks based on user input:
The user inputs the name of a region in the format "city,province" format egTorontoOntario The program extracts the first letter of the city name and the first letter of the province name to create a unique region code. Both letters are capitalized eg "Toronto,Ontario" yields the code TO
The user inputs the total amount of rainfall in millimeters as an integer eg mmThe program classifies the rainfall amount based on predefined categories:
Light for rainfall mm
Moderate for rainfall mm
Heavy for rainfall mm
Extreme for rainfall mm
The program then outputs both the region code and the classification of the rainfall.
You may assume the region name is always in the format "city,province" and that the rainfall amount is a positive integer.
Sample Run :
Enter region: Edmonton,Alberta
Enter rainfall:
EA
Heavy
Sample Run :
Enter region: toronto,ontario
Enter rainfall:
TO
Moderate
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
