added alternate version of ex 33 (b) using for loop and range()