import time import sys import math #Modifying Section Starts #only make edits in the modifying section mod = 0 #Testing Purposes only Type 'mod-admin' with the dash to test baselimit = 36 unary = 1 printable = [0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] base = ["Impossible Base-0","Unary","Binary","Ternary","Quarternary","Quinary","Senary","Septenary","Octal","Nonary","Decimal","Undecimal", "Duodecimal","Tridecimal","Tetradecimal","Pentadecimal","Hexadecimal","Septadecimal","Octodecimal", "Nonadecimal","Vigesimal","Unovigesimal","Duovigesimal","Trivigesimal","Tetravigesimal", "Pentavigesimal","Hexavigesimal","Septavigesimal","Octovigesimal","Nonavigesimal","Trigesimal", "Unotrigesimal","Duotrigesimal","Tritrigesimal","Tetratrigesimal","Pentatrigesimal","Hexatrigesimal"] #Modifying Section Ends version = "1.1 " dev = 0 devv = 4 if int(dev) == 0: if int(mod) == 1: print("Number Base Converter " + str(version) + " Modded") if int(mod) == 0: print("Number Base Converter " + str(version)) if int(dev) == 1: if int(mod) == 1: print("Number Base Converter " + str(version) + "Developmetal Version " + str(devv) + " Modded") if int(mod) == 0: print("Number Base Converter " + str(version) + "Developmetal Version " + str(devv)) while True: print("Enter the base you want to convert with.") print("Hey, you can only enter a number between 1 and " + str(baselimit) + "!") print("Hey, if you want to modify the program, type 'mod'.") variable = input() try: if str(variable) == 'mod': print("Step 1: Go into the Modifing Section.") print("Step 2: Make sure 'mod = 1' in the Modifying Section.") print("Step 3: Make 'baselimit' equal to whatever number in the Modifying Section.") print("Step 4: Make 'unary' equal to whatever you want it in the Modifying Section.") print("Step 5: If 'baselimit' is above " + str(baselimit) + " add the name in the 'base' in the Modifying Sections") print("Step 6: Add a number in 'printables' by adding a comma at the end but in the ") print("barckets and adding something on the same line in the Modifying Section") print("Enter the base you want to convert with.") print("Hey, you can only enter a number between 1 and " + str(baselimit) + ".") variable = input() elif str(variable) == 'mod-admin': inm = 1 for x in range(int(baselimit)): try: baseprint = base[int(inm)] except IndexError: baseprint = 'Error' try: D = printable[int(inm) - 1] except IndexError: D = 'Error' print(str(inm) + " " + str(baseprint) + " " + str(D)) inm = int(inm) + 1 if int(variable) > int(baselimit): print("Hey, You can't enter a number qreater than " + str(baselimit) + ".") continue elif int(variable) < 1: print("Hey, you can't enter a number below 1.") continue elif int(variable) < int(baselimit): baseprint = base[int(variable)] except ValueError: print("Hey, that's not a number, please enter a number.") continue if int(variable) > 1: print("How many digits do you want your conversion to be?") exponent = input() while True: if int(variable) > 1: print("Decimal to " + str(baseprint) + " " + str(exponent) + '-bit Converter') limit = int(variable)**int(exponent) - 1 print("Enter a number between 1 and " + str(limit) + ".") print("Type 'reset' if you are not satisfied.") elif int(variable) == 1: print("Decimal to Unary Converter") print("Type 'reset' if you arn't satisfied.") theirNumber = input() try: if str(theirNumber) == 'reset': break if int(variable) == 1: for i in range(int(theirNumber)): print(str(unary), end='') if int(variable) > 1: if int(theirNumber) > int(limit): print('Please type a number less than or equal to ' + str(limit)) if int(theirNumber) <= int(limit): for f in reversed(range(int(exponent))): #4 for n in reversed(range(int(variable))): #16 if int(theirNumber) >= n*int(variable)**f: D1 = printable[n] print(D1, end='') theirNumber = abs(int(theirNumber) - n*int(variable)**f) break except ValueError: print("Hey, that's not a number") print("\n")