Made it a one liner. Added try-except

Cleaned up the code a bit. Also added a try-except statement to make sure the the input which is being sqrt'ed is a number.