try statement and for loop