#try to avoid input function a = [1,2,3,4,"a", "world","hello","python", 1.2,43.44,3.14,[4,65,43],(4+6j),(3+5j), (54,32,2,4),[6.5,43,6.55,9.76],(1," ",3,5)] n = f = c = s = l = t = 0 for i in a: if type(i) == type(1): n = n+1 if type(i) == type(1.5): f = f+1 if type(i) == type((1j)): c = c+1 if type(i) == type("1"): s = s+1 if type(i) == type([]): l = l+1 if type(i) == type(()): t = t+1 print("Integers :",n,"\nFloat :",f,"\nComplex :",c,"\nstrings :",s,"\nLists :",l,"\nTuples :",t)
Click the run button. Try to avoid input() function.