human
Solve in Python:
Design an Iterator class, which has:

A constructor that takes a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments.
A function next() that returns the next combination of length combinationLength in lexicographical order.
A function hasNext() that returns True if and only if there exists a next combination.

 
Example:
CombinationIterator iterator = new CombinationIterator("abc", 2).
// creates the iterator.

iterator.next().
// returns "ab"
iterator.hasNext().
// returns true
iterator.next().
// returns "ac"
iterator.hasNext().
// returns true
iterator.next().
// returns "bc"
iterator.hasNext().
// returns false

 
Constraints:

1 <= combinationLength <= characters.length <= 15
There will be at most 10^4 function calls per test.
It's guaranteed that all calls of the function next are valid.

=====
Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.

class CombinationIterator:

    def __init__(self, characters: str, combinationLength: int):
        self.combinations = self.get_combinations(characters,combinationLength,0)        
        self.next_item=0

    def next(self) -> str:
        ans= self.combinations[self.next_item]
        self.next_item+=1
        return \"\".join(ans)

    def hasNext(self) -> bool:
        return self.next_item < len(self.combinations)

    def get_combinations(self,chars, k, start):
        ans = []
        if k == 0:
            return ans
        if k==1:
            return [[char] for char in chars[start:] ]
        count = 0
        for c in chars[start:]:
            for comb in self.get_combinations(chars, k - 1,start+count+1):
                    temp = []
                    temp.append(c)
                    temp.extend(comb)
                    ans.append(temp)
            count+=1
        return ans

            
        
        
        

# Your CombinationIterator object will be instantiated and called as such:
# obj = CombinationIterator(characters, combinationLength)
# param_1 = obj.next()
# param_2 = obj.hasNext()