0

I am writing a code that requires adding the element of list a and list b together to form a new list c

a=[0]

and list b is a list with len(b)<=1

However when b=[]

a=[0]
b=[]
c=[x + y for x, y in zip(a, b)]

c=[]

What is the easiest way to change the code to make c=[0] when b=[] without using an if statement?

illhahb
  • 81
  • 4

0 Answers0