<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at. The query string (? and beyond) may be truncated.>
<In what way does your code behave incorrectly? Include ALL error messages.>
I am trying to make a program which converts base 10 numbers to other bases of the user’s choice. The variable base_number is the user’s variable, and base_base is the user’s choice of which base to convert to.
There is a way to convert to different bases by dividing the base 10 number by the base and taking the remainder and repeating until it is not divisible and write the quotient followed by all the remainders. (EX. 50/6 = 8 R 2, 8/6 = 1 R2 so 50 in base 6 would be 122).
I created a list (remainder) so that it would append the remainder and gather all the remainders and get the quotient later and put it in order to get the user’s base number.
<What do you expect to happen instead?>
Thanks for looking at the code and helping me out!
def base():
base_number = raw_input("Please enter a number in base 10")
base_base = raw_input("What base would you like to convert it to?")
base_number = int(base_number)
base_base = int(base_base)
while (base_number / base_base) > base_base:
remainder = []
remainder.append(base_number % base_base)
print remainder
if base_number <= base_base:
print 'Your number in base ' + str(base_base) + ' is ' + str(base_number)
base()