-1

for example, I get

[[], [2, 3, 4, 5]]
[[1], [3, 4, 5]]
[[1, 2], [4, 5]]
[[1, 2, 3], [5]]
[[1, 2, 3, 4], []]

And I want to convert first list into [2,3,4,5], next [1,3,4,5], et cetera. I try to mutiply them all together but of course a list cannot mutiply a interger.

Daniel Hao
  • 4,922
  • 3
  • 10
  • 23
  • 2
    `[] + [2, 3, 4, 5]` will be `[2, 3, 4, 5]`; `[1] + [3, 4, 5]` will be `[1, 3, 4, 5]` etc. – mkrieger1 Jan 04 '23 at 00:32
  • You *can* multiply a list and an integer: e.g., `a * 3 == 3 * a == a + a + a`. Multiplication simply isn't what you want here. – chepner Jan 04 '23 at 01:04

1 Answers1

0

You can use itertools.chain:

>>> from itertools import chain
>>> list(chain.from_iterable([[1, 2], [4, 5]]))
[1, 2, 4, 5]
chepner
  • 497,756
  • 71
  • 530
  • 681