Spreadsheet column number
Convert a nonempty uppercase A-Z spreadsheet column label to its one-based number: A is 1, Z is 26, AA is 27.
prefix = 1 # A
print(prefix*26 + 2) # append BReason about the state
Treat each letter as a base-26 digit valued one through twenty-six. Multiply the accumulated prefix by 26 before adding the next digit. Before writing code, identify what each variable means after one iteration. Walk through the example and explain why the next transition preserves that meaning. Then check the smallest permitted input and a case with repeated values. A correct answer follows the contract for every input, including the boundary cases in the checks. Keep any input mutation within the stated rules; return a fresh result when the task asks for one.
Your task
Convert a nonempty uppercase A-Z spreadsheet column label to its one-based number: A is 1, Z is 26, AA is 27.
The explanation opens here once every check passes.