CSES - ABC list

Your task is to construct a list that contains all strings of length n consisting of the characters A, B and C. The list must be in alphabetical order.

You may assume that n is in the range 1 \dots 10.

In a file abclist.py, implement a function create that constructs the list.

def create(n):
    # TODO

if __name__ == "__main__":
    print(create(1)) # [A,B,C]
    print(create(2)) # [AA,AB,AC,BA,BB,BC,CA,CB,CC]
    print(len(create(5))) # 243