an updated calculator script with exception handlng