Advertisement
kxcoze

lab7_12

Feb 19th, 2020
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. arr = [int(x) for x in input('Введите исходный массив: ').split()]
  2. zero = []
  3. pos = []
  4. neg = []
  5.  
  6. for i in arr:
  7.     if i > 0:
  8.         pos.append(i)
  9.     elif i < 0:
  10.         neg.append(i)
  11.     else:
  12.         zero.append(i)
  13.  
  14. print('Измененный массив:', pos + neg + zero)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement