repl.it
@anonymous/

NumbTestyWoodpecker

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
examples = [
1234567,
999500,
999499,
102,
1000,
1001,
100000,
12345678912,
1452815612,
1302378490588
]

def f(n):s=str(n);l=len(s)-4;return f"{round(n,~l):,}"[:4].replace(*",.").rstrip('.')+"KMBT"[l//3+(int(s[3])>4)]if n>9999else n

for e in examples:
  print(e, "->", f(e))