• Register
0 votes

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

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)]
36.1k points

Related questions

1 vote
1 answer 18 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 samhaz 5k points
1 vote
1 answer 13 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 samhaz 5k points
0 votes
2 answers 53 views
Problem : Python Program to Calculate the Average of Numbers in a Given List
asked Oct 21, 2019 peterlaw 6.9k points
0 votes
1 answer 97 views
Problem : Facing following issue related to list in Python given that a refers to a list, write the necessary code to reverse the elements of the list.
asked Nov 16, 2019 peterlaw 6.9k points