I have a function with two inputs the numeric and the threshold. I want to compute the boolean statement true if the numeric is greater than the threshold. Upon computing my code I get the following error message:
'<' not supported between instances of 'int' and 'list'
See code:
num_list =([10, 1, 3, 7])
result =[]
def hits(num_list,threshold=5):
for x in num_list:
if threshold<num_list:
return true
num_list>7==Truedoes?int, in this case,thresholdwith a list,num_listusing the<operator, but that operation is not supported. Did you intend to usexinstead ofnum_list?True(uppercase) instead of true (lowercase - invalid name) Are you sure you want to return True after only one value is above the threshold?