design a program that lets the user enter the total rainfall for each of 12 months into an array

198 views

Problem :

I am facing below python list problem
design a program that lets the user enter the total rainfall for each of 12 months into an array

Solution :

In Python you can not use dictionaries so you can make a separate list for the month names as shown in below example:

`months = ["jan", "feb", "mar", ... ]`

Then you can use the index of the returned value in any given method to get the month name from the other list,as shown in below example:

```def lowest():
low = min(year)
month = months[year.index(low)]
```
38.6k points

Related questions

173 views
Problem: Write a program that reads in the rainfall for each of 12 months and outputs the month and the rainfall for the month. It should then output the month with the most rainfall, the month with the least rainfall, the total amount of rainfall for the year, and the average monthly ... SIZE; cout << "The average monthly rainfall for the year is " << average << " inches." << endl; } return 0; }
10 views
Problem: Please, someone, assist me: Design a program with a loop that lets the user enter a series of numbers?
63 views
Problem: Design a program that asks the user to enter a store sales for each day of the week. The amounts should be stored in a list. Use a loop to calculate the total sales for the week and display the ... "Friday", "Saturday", "Sunday"] dailySales = enterDailySales(daysOfTheWeek) totalDailySales = calculateWeeklySale(dailySales) printWeeklyReport(daysOfTheWeek, dailySales, totalDailySales)
14 views
Problem: Write a while loop that lets the user enter a number?
13 views
Problem: Is there anyone who knows the answer: Write a program that reads in a list of integers into an array with base type int?
6 views
Problem: Is there anyone who knows how to fix this problem : When a program lets the user know that an invalid menu choice has been made, this is an example of?
14 views
Problem: So, what precisely is the problem here: When a program lets the user know that an invalid choice has been made, this is known as?