Q. Write a program to read a list of n integers (positive as well as negative). Create two new lists, one having all positive numbers and the other having all negative numbers from the given list. Print all three lists.
Answer :-
lst = eval( input ("Enter a list :-") ) pos =[] neg = [] for i in lst : if i >= 0 : pos.append(i) else : neg.append( i ) print("Intial List :-", lst ) print("List of Positive Number :-", pos) print("List of Negative Number :-", neg)
good
ReplyDeleteThank you 😊
Deletethnk u for this solutions ans awesome and may i help u in future by chance
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )