Nov-19-2018, 02:01 PM
(This post was last modified: Nov-19-2018, 02:15 PM by ichabod801.)
hey guys, needing some help here! I need to make a program that is going to take a range of numbers which are to be temperatures and store them in a list, it then needs to find the percentage of the numbers in the list that are above 16 can anyone help with this at all? i have put the code below but I cannot for the life of me seem to get it going, im rubbish at programming, I have the bit where it prompts the user for the temperatures and all the temperatures are included that are in the assignment
# work out the percentage of the day that the office was warm enough #input temperatures of the office on hourly basis temperatures = [20,15,17,16,14,19,18,19] for n in range(1, 9): temperatures.append(int(input(f'Enter temp {n}: '))) # find the percentage of the day that the temperature was within acceptable range # Input a list of 8 numbers temperatures = [20,15,17,16,14,19,18,19] #sub-problem: compute the percentage total = 0 for temperatures in temperatures: total = total + temperatures # sub- problem: compute the length of the list length = 0 for temperature in temperatures: length = length +1 #output: percentage office was warm enough, a number percentage = total / 100 print('the percentage the office was warm enough', temperatures, 'is', percentage)