I am creating a python script for base62 encoding. However, for some reason, my code doesn't produce the correct answer. Correct answer is LpuPe81bc2w, but i get LpuPe81bc0w. If you can review my code and see if I can do any different. Please let me know. I can't use pybase62.
I really want to know why my code doesn't work because I want to understand fundamental. Preferably
NO PyBASE62 and I am a beginner.
base_62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
BASE = len(base_62)
def to_base_62(number):
rete=''
while number != 0:
rete = (base_62[number%BASE])+rete
number = int(number/BASE)
return rete
print (to_base_62(18327995462734721974))