Re: [Tutor] base n fractional

2009-04-06 Thread Chris Castillo
at 7:53 AM, Dave Angel wrote: > Chris Castillo wrote: > > Message: 1 >> Date: Sun, 5 Apr 2009 15:36:09 -0500 >> From: Chris Castillo >> Subject: [Tutor] base n fractional >> To: tutor@python.org >> Message-ID: >><50e459210904051336v60df

Re: [Tutor] base n fractional

2009-04-06 Thread Dave Angel
Chris Castillo wrote: Message: 1 Date: Sun, 5 Apr 2009 15:36:09 -0500 From: Chris Castillo Subject: [Tutor] base n fractional To: tutor@python.org Message-ID: <50e459210904051336v60dfc6ddt280d3c9c8f6e0...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1"

Re: [Tutor] base n fractional

2009-04-06 Thread Alan Gauld
"Chris Castillo" wrote well i want to use a for loop to work from the right most digit to the left most digit at a negative 1 increment. For each digit i want to divide it by 1/base and add the next digit. Then I need to take that sum and multiply it by 1/b to get the decimal equivalent so

Re: [Tutor] base n fractional

2009-04-05 Thread Chris Castillo
well i want to use a for loop to work from the right most digit to the left most digit at a negative 1 increment. For each digit i want to divide it by 1/base and add the next digit. Then I need to take that sum and multiply it by 1/b to get the decimal equivalent so when I say that to myself i se

Re: [Tutor] base n fractional

2009-04-05 Thread Alan Gauld
"Chris Castillo" wrote I need some help converting the fractional (right side of the decimal) to base 10. I have this but it doesn't work Frankly, based on your algorithm, I'm not sure what exactly you want to do but taking the above statement as a starting point I'd convert the fractional

[Tutor] base n fractional

2009-04-05 Thread Chris Castillo
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 f