Hi all i have a list that is calculated from functions
ab = (x, x1, x2, x3, x4, x5, x6, x7, x8)
where x, x1 and so on are float numbers calculated from a distance equation. Is there any way i can take each of these float values in the list and compare them to a known value. I.e
knowndistance = 200
and if the value is greater than the known distance print greater than and if it is less than print less than. Then i would like to gather all the less than and greater than results and put them into two separte lists with one being greaterthan[] and the other lessthan[]
so i want to compare all of the values in ab to see if they are greater than is there any code that can do this for me instead of typing if for each statement. My current code is below but that doesnt work for floats?
new_list = []
for i, x in enumerate(ab):
if x < knowndistance:
lessthan = "Station {} average is less than {}".format(i+1, knowndistance)
comicdb = []
record = {}
record = lessthan
comicdb.append(record)
new_list.extend(comicdb)
Thanks for your help in advance :)