Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Try solution in Clear category for Completely Empty by andrea.manno1
def completely_empty(val):
try:
for innerval in val:
if val==innerval or not completely_empty(innerval):
return False
return True
except TypeError:
return False
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert completely_empty([]) == True, "First"
assert completely_empty([1]) == False, "Second"
assert completely_empty([[]]) == True, "Third"
assert completely_empty([[],[]]) == True, "Forth"
assert completely_empty([[[]]]) == True, "Fifth"
assert completely_empty([[],[1]]) == False, "Sixth"
assert completely_empty([0]) == False, "[0]"
assert completely_empty(['']) == True
assert completely_empty(['no']) == False
assert completely_empty([[],[{'':'No WAY'}]]) == True
assert completely_empty([[{'No':'WAY'}]]) == False
print('Done')
July 15, 2017