[Python Tips] Underscores in Numeric Literals

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@themarkymark·
0.000 HBD
[Python Tips] Underscores in Numeric Literals
![](https://steemitimages.com/DQmSsFP8BDE1DkXNN9hh1729MRexyqupLEKfWJTsRskjt33/image.png)

This is a simple tip but can be very useful to visualize large numbers quickly.  This feature requires Python 3.6+.

When expressing large numbers in Python, you are unable to use a comma `,` separator but you are now able to use an underscore `_` to make large numbers more readable.

# Example time

Right now my reputation is 95,772,209,949,706.000 when looked at in raw form.  

#### To express this in Python you typically would use.

`themarkymark_rep = 95772209949706.000`

#### With python 3.6 you can use underscores in your **numeric literals** like this

`themarkymark_rep = 95_772_209_949_706.000`

This doesn't change how your code functions in anyway but does make it easier to visualize the scale of the number.

#### You can also use this when doing binary numbers such as

`flags = 0b_0011_1111_0100_1110`

# Python Tips Series
* [f-strings in Python 3.6](https://steemit.com/programming/@themarkymark/python-tips-f-strings-in-python-3-6-and-why-you-should-be-using-them)


<center><sub><sub> X48EJ </sub></sub></center>

# <center>  [Why you should vote me as witness](https://steemit.com/witness-category/@themarkymark/why-you-should-vote-for-themarkymark-as-witness)  </center> #
<center>https://steemitimages.com/DQmcWxV1dpA1eAtw2ipwZiWZkydyVNU5LaLa2Ak1GUnbGmS/The-Marky-Mark.png </center>

# <center> Witness & Administrator of four full nodes </center> #

![themarkymark.png](https://steemitimages.com/DQmVpwMxWTYDVum2dXcVRBLwHqHZh2Sr6DDHAFwDeeTG2YK/themarkymark.png)


</br>

# <center> My recent popular posts </center> #

[STEEM, STEEM Power, Vests, and Steem Dollars. wtf is this shit?](https://steemit.com/steem/@themarkymark/steem-steem-power-vests-and-steem-dollars-wtf-is-this-shit)
[The truth and lies about 25% curation, why what you know is FAKE NEWS](https://steemit.com/curation/@themarkymark/the-truth-and-lies-about-25-curation-why-what-you-know-is-fake-news)
[WTF is a hardware wallet, and why should you have one?](https://steemit.com/bitcoin/@themarkymark/wtf-is-a-hardware-wallet-and-why-should-you-have-one)
[GINABOT - The Secret to your Sanity on Steemit](https://steemit.com/ginabot/@themarkymark/ginabot-the-secret-to-your-sanity-on-steemit)
[How to calculate post rewards](https://steemit.com/steemit/@themarkymark/how-to-calculate-post-rewards)
[Use SSH all the time? Time for a big boy SSH Client](https://steemit.com/linux/@themarkymark/use-ssh-all-the-time-time-for-a-big-boy-ssh-client)
[How to change your recovery account](https://steemit.com/steemit/@themarkymark/how-to-change-your-recovery-account)
[How curation rewards work and how to be a kick ass curator](https://steemit.com/curation/@themarkymark/how-curation-rewards-work-and-how-to-be-a-kick-ass-curator)
[Markdown 101 - How to make kick ass posts on Steemit](https://steemit.com/steemit/@themarkymark/markdown-101-how-to-make-kick-ass-posts-on-steemit)
[Work ON your business, not in your business! - How to succeed as a small business](https://steemit.com/business/@themarkymark/work-on-your-business-not-in-your-business-how-to-succeed-as-a-small-business)
[You are not entitled to an audience, you need to earn it!](https://steemit.com/steemit/@themarkymark/you-are-not-entitled-to-an-audience-you-need-to-earn-it)
[How to properly setup SSH Key Authentication - If you are logging into your server with root, you are doing it wrong!](https://steemit.com/sysadmin/@themarkymark/how-to-properly-setup-ssh-key-authentication-if-you-are-logging-into-your-server-with-root-you-are-doing-it-wrong)
[Building a Portable Game Console](https://steemit.com/raspberrypi/@themarkymark/building-a-portable-game-console)

[![](https://steemitimages.com/DQmPkQhAQceC7aHr4Gy5GKv7LMoiy47P7PyaNCeZBHMpFke/white-bg-with-drop-shadow.gif)](https://v2.steemconnect.com/sign/account-witness-vote?witness=themarkymark&approve=1)
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,