I teaching myself python so very much a beginner. This was a problem given to me to see if can solve it. Compare a list of numbers to one integer and if the last number in the list is higher than the lone integer it should return the string "Higher" and "Smaller" if it Smaller. It is the same number it should return the first integer in the list. This is the code I have so far. I is for interation which means it will look through the list, right? I understand the conditionals: if, else and then the first index position is O. But what does "type object not subscriptable" mean?
def problem1(aList, number):
for i in aList:
if i in range [aList] > number:
return ("Larger")
if i in range [aList] < number:
return ("Smaller")
else:
return aList[0]