Advertisement
fkudinov

12. Flatten a List / Вирішуємо задачі на Python CheckIO Українською

Dec 7th, 2023
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | Source Code | 0 0
  1. def flat_list(array):
  2.     return
  3.  
  4.  
  5. if __name__ == '__main__':
  6.     assert flat_list([1, 2, 3]) == [1, 2, 3], "First"
  7.     assert flat_list([1, [2, 2, 2], 4]) == [1, 2, 2, 2, 4], "Second"
  8.     assert flat_list([[[2]], [4, [5, 6, [6], 6, 6, 6], 7]]) == [2, 4, 5, 6, 6, 6, 6, 6, 7], "Third"
  9.     assert flat_list([-1, [1, [-2], 1], -1]) == [-1, 1, -2, 1, -1], "Four"
  10.     print('Done! Check it')
Tags: checkio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement