How to Print number with commas or dot as thousands separater | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to Print number with commas or dot as thousands separater

Hello :), I want to print the following code, but to see it separated in thousands by commas, or preferable dots: Idades = [("Abel", 33), ("Luciana", 29), ("Nuninho", 36), ("Pedro", 41)] segundos = lambda Idades: (Idades[0], Idades[1]*31104000) Anos_Segundos = list(map(segundos, Idades)) I found this solution: (f"{X:,d}") But first I don`t know how to insert it on the upper code, and secondly I would rather prefer the thousands separator to be dot(.) instead of comma(,) Thanks in Advance :)

24th Sep 2018, 10:09 PM
Abel Pinheiro
Abel Pinheiro - avatar
1 Answer
0
Thank you for your reply :). But don`t you think that this would be much more simpler and cleaner: i.: print("{:,}".format(1000000)) o.: 1,000,000 ?? The problem is that this can only be applied to Strings, and not to Tuples, and thats my case. So I continue stuck!! :/ Thank you anyway for your help! :)
25th Sep 2018, 11:32 AM
Abel Pinheiro
Abel Pinheiro - avatar