DEV Community

Raghav Rathi
Raghav Rathi

Posted on β€’ Edited on

2

🀯: 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

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs