Now write a function with signature:
incrementString(text="AAAA")
The function must "increment" the given string. Here are some examples:
incrementString("A") # Returns "B"
incrementString("Z") # Returns "AA"
incrementString("AM") # Returns "AN"
incrementString("AZ") # Returns "BA"
incrementString("BA") # Returns "BB"
incrementString("BZ") # Returns "CA"
incrementString("ZZA") # Returns "ZZB"
incrementString("ZZZ") # Returns "AAAA"
incrementString("AAAA") # Returns "AAAB"
incrementString("AAAZ") # Returns "AABA"
incrementString("ABC2") # Raises a ValueError
The characters in text must be A-Z (or a-z, in which case the function must
upper-case them); otherwise the function should raise a ValueError
exception.
This is a bit more challenging than the previous exercises. The code can be
written in under twenty lines if you use a couple of list comprehensions,
although it can also be written without them. It is a bit tricky to get right. (Hint:
The reversed() function returns a sequence in reverse order.)