assert If a condition in your code returns True, if not, the program will raise an AssertionError. def cal(nums): assert len(nums)>0, "list must not be empty" total=sum(nums) avg=total/len(nums) return avg data=[5, 10, 15, 20] result=cal(data) result >>> 12.5 You can write a message to be written if the code returns False. def cal(nums): assert len(nums)>0, "list must not be empty" total=sum(num..