DEV Community

Raghav Rathi
Raghav Rathi

Posted on • Updated on

🀯: Python `___` can be used in numbers ??

πŸ’¬: Comment Your Thoughts or Anything


πŸ‘¨β€πŸ’»: Code

a = 1_00_00000.000_000
# b = 10000000.000000
# here b is same as a

print(f'{a:,}')
print('{:_}'.format(a))
Enter fullscreen mode Exit fullscreen mode

πŸ–₯️: Output

output of code

πŸ€”: How to use it

  • its numbers / double delimiter
  • you can use underscore as a ,
  • which doesn't affect the value / meaning of the number
  • Can't use it
    1. at start & end of number
    2. before & after the decimal point .
    3. or multiple underscores in a row

πŸ”’: Maths

  • its like the maths ,
  • which we use in daily life

🧡: fString

  • while printing in console
  • can use fstring to print it like that
  • NOTE:
    • but it will come after every 3 digit in output
    • as American Standard
    • not how you added in Number

πŸƒβ€β™‚οΈ: to Run

πŸ‘€: See also


❀️: A Like would be appreciated if it was helpful

Top comments (0)