Write a function that returns seperate lists of positive and negative numbers from an input list
Topic: Write a function that returns seperate lists of positive and negative numbers from an input list
Solution
def seperate_pn(l): pos_list = [] neg_list = [] for _ in l: if _<0: neg_list.append(_) else: pos_list.append(_) return pos_list, neg_list
List all Python Programs