I am trying to create a function which would take a list and be able to count the number of ints floats and str in that list.
output should be:
list =
freq = countDataTypes(list)
print(freq)
[2,1,1]
any help would be greatly appreciated
so far:
>>> def countDataTypes(aList):
rtnlist = [0,0,0]
for x in aList:
if type(x) is string:
the rtnlist[0,0,0] is what this will return. if there are 2 ints, 1 float and 0 str then rtnlist[2,1,0]