range function using class & iter functions