How would you return None with empty lists, I am struggling to
figure out how. The code below is incomplete but it gives an idea.
Essentially I wanna call the function, a,b = a() and then since a
contains only 0's I want it to return None and return a and b
as empty lists [], to the function a,b = a(). And no
imports.
def a():
a = [0, 0, 0, 0]
b = [0, 0, 2, 0]
none(a,b)
return a,b
def none(a,b):
variables =
if all([ values == 0 for values in variables[0]
]):
print("Appears program ran into an
error state: Lists contains all zero values")
a = []
b = []
return None
a, b = a()
Thanks
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!