#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 = [],[],[],[],[],[] for i in a: if type(i) == type(1): n.append(i) if type(i) == type(1.5): f.append(i) if type(i) == type((1j)): c.append(i) if type(i) == type("1"): s.append(i) if type(i) == type([]): l.append(i) if type(i) == type(()): t.append(i) print("Integers :",tuple(n),"\nFloat :",tuple(f),"\nComplex :",tuple(c),"\nstrings :",tuple(s),"\nLists :",tuple(l),"\nTuples :",tuple(t))
Click the run button. Try to avoid input() function.