I am learning data structures and algorithms and decided to start up a quick code for separating a list into data types. My goal is to have a loop that checks each value in a list and then have if statements to determine whether it's an int, bool, string, or float. I am not sure why, but something with the conditional statements is off because it runs my final "else" statement.
myList = ['test',3,True,'chicken',False,95,33/4,.02,'rabbit',False]
myInts = []
myBools = []
myStrings = []
myFloats = []
for a in myList:
if a == int:
myInts.append(a)
elif a == bool:
myBools.append(a)
elif a == str:
myStrings.append(a)
else:
myFloats.append(a)
print('Ints:', myInts)
print('Bools:',myBools)
print('Strings:',myStrings)
print('Floats:',myFloats)