+ 1
How can i add commas in between numbers which come as an output
Eg :- 10000000 into 10,000,000 https://code.sololearn.com/co57aH1MVxRv/?ref=app
2 Réponses
+ 9
P A Arrchith Iyer ,
you can use a f-string to format and do the desired output:
num = 10000000
print(f'{num:,}')
output will be:
10,000,000
+ 3
#To write code, you can use an underscore:
num = 10_000_000
#To output data together with a variable in a formatted string, either with an underscore or with a comma:
print(f'{num = :,}')