Q. Write a program to obtain temperature of 7 days (Monday….sunday) and then display average temperature of the week.


You can understand by Watching video :-



Answer :-

a = int(input("Enter the 1st day temperature  = "))
b = int(input("Enter the 2nd day temperature = "))
c = int(input("Enter the 3rd day temperature = "))
d = int(input("Enter the 4th day temperature = "))
e = int(input("Enter the 5th day temperature = "))
f = int(input("Enter the 6th day temperature = "))
g = int(input("Enter the 7th day temperature = "))
average = (a + b+ c + d +e + f + g )/7
print("Average of temperature = ",average ,"C")

Output :-

Enter the 1st day temperature  = 35
Enter the 2nd day temperature = 28
Enter the 3rd day temperature = 32
Enter the 4th day temperature = 33
Enter the 5th day temperature = 30
Enter the 6th day temperature = 29
Enter the 7th day temperature = 36
Average of temperature =  31.857142857142858 C

>>> 

Enter the 1st day temperature  = 20
Enter the 2nd day temperature = 21
Enter the 3rd day temperature = 22
Enter the 4th day temperature = 23
Enter the 5th day temperature = 24
Enter the 6th day temperature = 25
Enter the 7th day temperature = 26
Average of temperature =  23.0 C

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post