Your task is to construct a list that contains all strings of length n consisting of the characters A, B and C so that two adjacent characters are never the same. The list must be in alphabetical order.
You may assume that n is in the range 1 \dots 10.
In a file abcdiff.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)) # [AB,AC,BA,BC,CA,CB] print(len(create(5))) # 48