program in python to take temperature of all seven days of the week and display the average temperature of that week


Write a program in python to take temperature of all seven days of the week and display the average temperature of that week?

d1=int(input("Enter the temperature of day 1 : "))
d2=int(input("Enter the temperature of day 2 : "))
d3=int(input("Enter the temperature of day 3 : "))
d4=int(input("Enter the temperature of day 4 : "))
d5=int(input("Enter the temperature of day 5 : "))
d6=int(input("Enter the temperature of day 6 : "))
d7=int(input("Enter the temperature of day 7 : "))
avg=(d1+d2+d3+d4+d5+d6+d7)/7
print("The average temperature of a week is : ",avg)

Output:-

Enter the temperature of day 1 : 22
Enter the temperature of day 2 : 34
Enter the temperature of day 3 : 33
Enter the temperature of day 4 : 23
Enter the temperature of day 5 : 43
Enter the temperature of day 6 : 43
Enter the temperature of day 7 : 32

The average temperature of a week is :  32.857142857142854

Post a Comment

0 Comments