Computer Science
Write a program to obtain temperatures of 7 days (Monday, Tuesday … Sunday) and then display average temperature of the week.
Answer
d1 = float(input("Enter Sunday Temperature: "))
d2 = float(input("Enter Monday Temperature: "))
d3 = float(input("Enter Tuesday Temperature: "))
d4 = float(input("Enter Wednesday Temperature: "))
d5 = float(input("Enter Thursday Temperature: "))
d6 = float(input("Enter Friday Temperature: "))
d7 = float(input("Enter Saturday Temperature: "))
avg = (d1 + d2 + d3 + d4 + d5 + d6 + d7) / 7
print("Average Temperature =", avg)
Output
Enter Sunday Temperature: 21.6
Enter Monday Temperature: 22.3
Enter Tuesday Temperature: 24.5
Enter Wednesday Temperature: 23.0
Enter Thursday Temperature: 23.7
Enter Friday Temperature: 24.2
Enter Saturday Temperature: 25
Average Temperature = 23.47142857142857
Related Questions
Write a program to take year as input and check if it is a leap year or not.
Write a program to obtain x, y, z from user and calculate expression : 4x4 + 3y3 + 9z + 6π
Write a program that reads a number of seconds and prints it in form : mins and seconds, e.g., 200 seconds are printed as 3 mins and 20 seconds.
[Hint. use // and % to get minutes and seconds]Write a program to obtain principal amount, rate of interest and time from user and compute simple interest.