Hi, I'm self learning Python and I need some help (desperately) - I understand that I am double accounting in my simple program (I am adding the total for above 1.57 and also adding for below 1.92). I've spent time attempting to write a nested if statement (if index >=1.57 and <= 1.92) but it isn't working.
Can someone on here help me please?? Oh I'm using version 3 I understand the syntax is different in earlier versions.
Can someone on here help me please?? Oh I'm using version 3 I understand the syntax is different in earlier versions.
total = 0 all_heights = [1.87, 1.48, 1.57, 1.91, 2.01] for index in all_heights: if index >=1.57: total = total +1 if index <= 1.92: total = total +1 print ("The total number of qualifying astronauts is ",total) time.sleep (2)print ("It's not is it - the program is double counting the total")