• Register
0 votes
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
6.9k points

Please log in or register to answer this question.

1 Answer

0 votes

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

0 votes
1 answer 173 views
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; }
asked Apr 26 Moumita Bhowmick 12.9k points
0 votes
1 answer 10 views
10 views
Problem: Please, someone, assist me: Design a program with a loop that lets the user enter a series of numbers?
asked Jun 16 Shima 126k points
0 votes
1 answer 63 views
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)
asked Apr 25 Humaira ahmed 50.7k points
0 votes
1 answer 14 views
14 views
Problem: Write a while loop that lets the user enter a number?
asked Jun 26 Nahil 128k points
0 votes
1 answer 13 views
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?
asked Jun 13 Nahil 128k points
0 votes
1 answer 6 views
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?
asked Jun 10 Mezbah 130k points
0 votes
1 answer 14 views
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?
asked Jun 12 Nahil 128k points
0 votes
1 answer 25 views
25 views
Problem: These are the instructions: Implement a C++ console application that simulates a Rock-Paper-Scissor game against the computer. When played between two people, each person picks one of three options (usually shown by hand gesture) at the same time, and a winner is determined. In the ... would like to know: * Why this code is not running. * How do I add a way to keep score on a text file.
asked May 1 Yeamin 23.5k points
0 votes
1 answer 3 views
3 views
Problem: If you add 7 to each entry on a list that adds 7 to the average? Need help with this.
asked Jun 21 Aurelia Maja 78.4k points
0 votes
1 answer 87 views
87 views
Problem: How to Write a program that prompts the user to enter an integer for today's day of the week (Sunday is 0 ,Monday is 1,... and Saturday is 6). Also, prompt the user to enter the number of days after today for a future day and display the future day of the week Thank you
asked Apr 25 ummeshani 10.8k points