What am I doing wrong? I am to take the average number of each cooled, heated, regular and either subtract the degrees below 60(heated) or above 80(cooled),then add that number to the number of days
# Chpt 8#11Tempdays.py
# A program to add a set of temperatures enter by the user
# and determine the number of cooled days and heated days

def main():
sum = 0
#number of days
count = 0
#average daily temperature
xStr = raw_input("Enter a Temperature (999 to quit)>> ")
while xStr != 999:
x = eval(xStr)
sum = sum + x
count = count + 1
aver = int(sum/count)
# cooling days
if aver > 80:
count1=0
count1 = count1 + 1
a = abs(80-aver)
y = a + count


#heating days
elif aver < 60:
count2=0
count2 = count2 + 1
b = abs(60-aver)
count2 = count2 + 1
b = b + count2
#regular days

else:
c = count
xStr = raw_input("Enter a number (999 to quit) >> ")

print "The number of the days is",c,
print "The number of cooled days are", y,
print "The number of heated days are",b,


main()
( .16)
Also How do I get ( A ) in python language? (that is A exponent .16 .?)

Recommended Answers

All 4 Replies

Thank-you. I am new to programming. This is my first course and I'm taking it on-line. I'm having a few problems, so any help I can get I appreciate. Do I need to post again, My indentions were correct.

Yes, post your code again, in tags this time, you will get more help!

thank-you I got it. This time. YOu know those road blocks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.