File size: 177 Bytes
e4456e8
 
 
 
 
 
 
1
2
3
4
5
6
7
8
def thousand_to_k(x):
    if x >= 1000:
        return thousand_comma_separated(x // 1000) + 'k'
    return str(x)

def thousand_comma_separated(x):
    return "{:,}".format(x)