I need some help converting the fractional (right side of the decimal) to
base 10.
I have this but it doesn't work

mynum = raw_input("Please enter a number: ")
myint, myfrac = mynum.split(".")
base = raw_input("Please enter the base you would like to convert to: ")
base = int(base)
mydecfrac = 0
fraclen = len(myfrac) - 1

for digit in range(len(myfrac) -1, -1, -1):
    mydecfrac = mydecfrac + int(myfrac[digit])
    mydecfrac = mydecfrac / base
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to