class range """ class that mimic the built-in range class "" def init (selfstartstop=nonestep= ) """initialize range instance semantics is similar to built-in range class "" if step = raise valueerrorstep cannot be if stop is nonespecial case of range( startstop start should be treated as if range( , calculate the effective length once self length max( (stop start step /step need knowledge of start and step (but not stopto support getitem self start start self step step def len (self) """return number of entries in the range "" return self length def getitem (selfk) """return entry at index (using standard interpretation if negative"" if +len(selfattempt to convert negative index if not < self length raise indexerrorindex out of range return self start self step code fragment our own implementation of range class