how to copy specific values from one list to another in Python -


this question has answer here:

i'm still learning basics of python , trying numbers plist , pass them plist2 end plist2 = [0.50, 1, 2, 0.125]

plist = [(0.50,'hello'),(1,'betty'),(2,'cat'),(0.125,'man')] plist2 = [] 

using tuples unpacking , type checking:

 a, b in plist:     if type(a) == int or type(a) == float:         plist2.append(a)  

Comments