Why doesn't Exception Handling work in some cases

Statistical Mean doesn’t work in both the cases: blank inputs and string inputs

However, my exception handling only works in one of these:

  1. try:
    print(sts.mean())

except ValueError as ve:
print(type(ve).name,"->",ve)
StatisticsError -> mean requires at least one data point

Exception Handling works successfully here.

  1. But not in the next case:

Can someone help me out here, as to why this happens?

Found the error:

Correct Code to use should be :slight_smile:

except Exception as e:
print(type(e).name,"->",e)

Thanks for sharing the solution with us @riddhi.luthra