• Register
0 votes
156 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 5 3
6,930 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)]
   
9 7 4
38,600 points

Related questions

1 vote
1 answer 183 views
183 views
Problem: I wrote a program that asks the user to enter the amount of a purchase and then it sums up the total bill with 15% vat and 0.07% service tax. I wrote the program in python: vat = 0.15 sales_tax = 0.075 product_price = float(input("Please enter the ... not defined I can not solve this thing. I am new in python programming language so please help me to solve this error. Thanks in advance.
asked May 6, 2020 samhaz 5k points
0 votes
1 answer 1 view
1 view
Problem: can someone please help for this problem? write a program that prompts the user to enter an integer
asked 9 hours ago Rohit kr 15k points
0 votes
1 answer 10 views
10 views
Problem: For a list ["foo","bar","baz"]and a list item "bar", what is the cleanest way to get its index (1) in python?
asked Feb 27 sasha 16.2k points
0 votes
1 answer 26 views
26 views
Problem: How can I write a program that reads an unspecified number of integers and then prints how many numbers the user has entered and their sum without using a list or array?
asked Feb 27 Code Learner 9.2k points
1 vote
1 answer 860 views
860 views
Problem: I wrote a program in python that asks the user for a number n and prints the sum of the numbers 1 to n: x = 1, addition = 0 n = int(input('Please enter a number:')) for i in range(x, n): addition = addition + i print (addition) But when ... n): TypeError: 'tuple' object cannot be interpreted as an integer Is there any thing that is missing from my code. Please help me to solve this out.
asked Jun 10, 2020 samhaz 5k points
0 votes
1 answer 3 views
3 views
Problem: How I can fix this: write a program that asks the user to type 10 integers of an array
asked Mar 19 Wafa Abu Yousef 6.1k points
0 votes
1 answer 4 views
4 views
Problem: I have this any help: write a program that asks the user to type 10 integers of an array
asked Mar 17 Wafa Abu Yousef 6.1k points
0 votes
2 answers 245 views
0 votes
1 answer 3 views
3 views
Problem: I'll make a submission for a response to my question. Please, I have searched the internet but have not found any useful material, and I am now having trouble continuing my studies.
asked Mar 29 tuhin1 47.2k points