mode, opcode = divmod(self.reg[self.ip], 100) for i in range(1, nargs): m, mode = divmod(mode, 10) #do stuff with m