A
A
Artur2020-06-29 16:21:17
Python
Artur, 2020-06-29 16:21:17

How to display numbers with dots, 1000000 -> 1.000.000?

How to display numbers with dots, 1000000 -> 1.000.000 ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
zexer, 2020-06-29
@rackev

https://stackoverflow.com/questions/49868257/pytho...

V
VB2007, 2020-06-29
@VB2007

Here is such a simple program suitable for numbers from 1 to 999999999 if it is known that there will not be round numbers like 1000987 or 123456000 in the number, the program will display 1.0.987 and 123.456.0

if a >= 1000000:
  a=str(a//1000000)+'.'+str(a%1000000//1000)+'.'+str(a%1000)
elif a >=1000:
  a=str(a//1000)+'.'+str(a%1000)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question