Chapter 3 Ques 1 ( taking the list input )