myinput = raw_input("Please enter a binary real number: ") myinput = myinput.split(".")
binstr1 = myinput[0] binstr2 = myinput[1] decnum1 = 0 decnum2 = 0 for i in binstr1: decnum1 = decnum1 * 2 + int(i) for k in binstr2: decnum2 = decnum2 * 2 + int(k) print "\nThe binary real number ", binstr1, ".", binstr2, " converts to ", decnum1,".",decnum2," in decimal." that is what I have so far but I need to create a condition where I need only 10 sufficient numbers from the variable decnum2. I know I need something like if len(decnum2) > 11: decnum2 = decnum2[0:11] but I keep getting unsubscriptable errors. I know it has to do with types but it's late and I just need some help. thank you in advance. - chris
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor