Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

program to segregate positive and negative numbers in same list

#program to segregate positive and negative numbers in same list
a=eval(input('Enter a list :'))
a.sort(reverse=True)
print(a)
+-+-+-+-+-+-+-+-+-+-+--+-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#output:
Enter a list :[1,-2,3,4,-5,6,-7,8,-9]
[8, 6, 4, 3, 1, -2, -5, -7, -9]
 
PREVIOUS NEXT
Tagged: #program #segregate #positive #negative #numbers #list
ADD COMMENT
Topic
Name
4+1 =