LLM
unknown
python
a year ago
890 B
3
Indexable
Never
import sys def to_base26_bard(number): """Converts a non-negative number to base-26, using the alphabet 0-9 and A-P. Args: number: The number to convert. Returns: The number in base-26. """ if number < 0: raise ValueError("Input should be a non-negative integer.") base26_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" result = "" while number > 0: result = base26_digits[number % 26] + result number //= 26 return result def to_base26_gpt4(num): if num < 0: raise ValueError("Number must be non-negative") alphabet = '0123456789ABCDEFGHIJKLMNOP' result = '' if num == 0: return '0' while num > 0: num, i = divmod(num, 26) result = alphabet[i] + result return result if __name__ == '__main__': print(to_base26_bard(int(sys.argv[1]))) print(to_base26_gpt4(int(sys.argv[1])))