Question

write the assignment in python

Homework assignment 2 (PDF).pdf

write it in python 

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#Global two dimensional list
l1=[]
#To read the data and stores it in two dimensional list
def getdata():
    global l1 #to access the global list l1
    # Taking input of high and low temperature for 12 months(year)
    for i in range(12):
        l=[]
        high=int(input("Enter high temperature:"))
        low=int(input("Enter low temperature:"))
        l.append(high)
        l.append(low)
        l1.append(l)

#To calculate average high temperature during the whole year
def averageHigh():
    s=0
    for i in range(12):
        s=s+l1[i][0]
    return s/12
#To calculate average Low temperature during the whole year
def averageLow():
    s=0
    for i in range(12):
        s=s+l1[i][1]
    return s/12
#To calculate the index of the month having highest temperature
#Index 0 means 1st month and index 11 means  12th that means last month
def indexHighTemp():
    max=l1[0][0]
    for i in range(1,12):
        if(l1[i][0]>max):
            max=l1[i][0]
            j=i
    return j
#To calculate the index of the month having lowest temperature
def indexLowTemp():
    min=l1[0][1]
    for i in range(1,12):
        if(l1[i][1]

return s/12 #To calculate the index of the month having highest temperature #Index means 1st month and index 11 means.12th thC:\Users\Megha\PycharmProject\new\venv\Scripts\python.exe C:/Users/Megha/PycharmProject/new/megha.py Enter high temperature:Average high temperature: 35.5 Average low temperature: 21.75 Index of month having highest temperature: 7 Index of month hav

Know the answer?
Add Answer to:
write the assignment in python
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT