#try to avoid input function a = (1,2,3,4,"hello","good","morning","friends",1.23,3.14,55.43,(1j),(54j),[1.1,1.2,1.3],["hi","hello"],[1,2,3],("a","b","c"),(101,102)) 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.