can you help guys?

Dave Angel davea at davea.name
Fri Apr 24 07:07:25 EDT 2015


On 04/24/2015 04:29 AM, brokolists wrote:
> 24 Nisan 2015 Cuma 02:20:12 UTC+3 tarihinde Steven D'Aprano yazdı:
>> On Fri, 24 Apr 2015 01:51 am, brokolists wrote:
>>
>>> my problem is i m working with very long float numbers and i use
>>> numberx =float(( input( 'enter the number\n ')))
>>> after i use this command when i enter something more than 10 or 11 digits
>>> it uses like 1e+10 or something like that but i have to calculate it
>>> without scientific 'e' type. what can i do to solve this? (sorry for my
>>> bad english)
>>
>>

>
> i fixed the "e" problem by using digits
>
> getcontext().prec=20
> it works fine but in my algoritm it was checking the answers by their lenght so this created a new problem by giving all the answers with 20 digits. I might fix this but i have searched for 4 hours just how to get rid of 'e' . i think there must be a easier way to do this.
>

We could be a lot more helpful if you just spelled it out.  digits and 
getcontext() are not builtins, so we don't really know how you're using 
them, except by guessing.

You've changed the code, probably by using one of the many suggestions 
here.  But what's it look like now?

You should have started the thread by telling us the Python version. 
I'm guessing you're using python 3.x


In Python 3.x, input() returns a string.  So you can tell how much the 
user typed by doing a len() on that string.  Once you convert it into 
some other form, you're choosing the number of digits partly by how you 
convert it.

Can you state what your real assignment is?  And what code you have so 
far?  And just what is wrong with it, that you need to change?

For example, if the "correct" answer for your user is "7.3"  and the 
user types  "7.300" is that supposed to be right, or wrong?




-- 
DaveA



More information about the Python-list mailing list