wrote code for question