Updated file - Solution.py

Updated with try/except block