changed the return of float value to include a try except