long time ago I wrote a simple program that adds the amounts of checks and does some analysis on them for my business , it simply asks for the amount of the check and the dates . in Iran due to inflation most of the checks have too many zeros on them and it helps to see them seperated by ',' as we type them in , that was the reason I asked .
I am guessing that you used the built-in float type for this, but given that you are dealing with currency, I would recommend using the decimal module for representing the monetary value instead, to get the best control over the significant decimal places, and applying locale.currency() to format the value as a string. While the links I posted are for the Python 3.4 docs, thhis should apply to Python 2.7 as well.
thank you guys for your suggestions , but what I am looking for is this : suppose my program asks for the amount on the check , as I am typing , I like to see the numbers being seperated in thousands , in other words looking at snippsat code when I am asked for the value in line one , and I enter the number without ',' I want it to appear like line 4 eg:
>>> amount=int(input('please enter the amount of the check '))
please enter the amount of the check 1,000,000,000
thanks Gribouillis , that is what I thought too , but looking at snippsat code I got an idea , I can input the numbers using ',' (do I have to declare them as strings ? ) and then inside my code change them to float or int
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.