[Tutor] (no subject)

Soliman, Yasmin ysoliman at uncc.edu
Mon Apr 15 02:35:51 CEST 2013


Hi everyone. I just need to know why this programs tells me End is not defined, what can I o to fix this issue? Thanks in advance.

hrList=[]
while True:
    heartrate= float(input('Enter heart rate as beats per min: '))
    hrList.append(heartrate)
    
    if heartrate=='End':
        print '\nThank you for using this program! Bye.'
        break     
    
    total_sum = 0;
    length = len(hrList)
    
    for i in range(0, length):
        total_sum += hrList[i]
    
    average = total_sum / length
    
    print average 


More information about the Tutor mailing list