Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while True:
- divisor = input("convert base10 to a base between 1 and 9.\nenter a base or E to exit: ")
- if divisor.upper() == "E":
- break
- base10 = int(input("Enter a number base10: "))
- basex = []
- while base10 != 0:
- num = base10%int(divisor)
- basex.append(str(num))
- base10 = base10//int(divisor)
- #print(num, base10)
- print("base" + divisor + ": ", "".join(basex[::-1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement