Jul-13-2020, 09:31 AM
I get an error saying, print('The input list is:', temperatures)
NameError: name 'temperatures' is not defined
This is my code:
The table is,
Input Output
[4.7] []
[5.2] [5.2]
[0, 3, 5, 7, 5, 4, 2, 0, -0.2]. [7,-0.2]
NameError: name 'temperatures' is not defined
This is my code:
#initialise the input_list with the given values #initialise the output_list to the empty list def get_input(): temperatures = get_input() input_list = list( map(float, input("\nEnter the temperatures:").strip().split())) #if the input_value satisfies the condition: return input_list temperatures = get_input() output_list = [] for i in temperatures: if i > 0.0 and i < 5.0: point = 0 # append the input_value to the output_list else: output_list.append(i) # print the output_list print('The input list is:', temperatures) print('The output list is:', output_list)How do I define Temperatures?
The table is,
Input Output
[4.7] []
[5.2] [5.2]
[0, 3, 5, 7, 5, 4, 2, 0, -0.2]. [7,-0.2]