How do I remove a list from with in a list, into a new list? So subtract b from a to produce a new list, c?
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]
b = [3, 4, 5, 6]
c = []?
Convert the lists into a set and take the set difference.
c = list(set(a).difference(set(b))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With