Given some alphanumerical strings in Python such as
A9B44BC1014D4
how do I check if the string is a valid Excel cell (i.e., letters come before numbers)?
I've tried using the .isalpha and .isdigit methods to "gather" letters and numbers, and then using .index to check whether all letters appear before numbers, but my logic is becoming too complex, and I feel like I'm not accounting for all possibilities.
Is there a simple way to achieve this?
Expected result:
>>> is_valid_excel_cell('A9')
True
>>> is_valid_excel_cell('B44B')
False
>>> is_valid_excel_cell('C101')
True
>>> is_valid_excel_cell('4D4')
False
