why this code is throwing error at the last requirement not able to understand.... please clarify