Evaluating,
max_val = max(a)
will cause the error,
ValueError: max() arg is an empty sequence
Is there a bett
Another solution could be by using ternary operators:
nums = [] max_val = max(nums) if nums else 0
or
max val = max(iter(nums) if nums else [0])