diff --git a/_posts/2019-01-10-tip-for-writing-large-numeric-values-in-code.md b/_posts/2019-01-10-tip-for-writing-large-numeric-values-in-code.md new file mode 100644 index 0000000..767d48d --- /dev/null +++ b/_posts/2019-01-10-tip-for-writing-large-numeric-values-in-code.md @@ -0,0 +1,22 @@ +--- +layout: post +title: "Tip for writing large numeric values in code" +date: "2019-01-10 15:24:51 +0530" +--- + + +### Putting underscores in defining Integers: + +It is difficult to read when a variable is having a large decimal value. Many +times I myself put finger on the screen and count the places to get an idea. In +this version, you can put ```_``` for separating numbers for constructing more +readable value. + +![Integer with underscore](/assets/images/numeric_value_with_underscores/integer_example.gif) + +Below is the code used in the example + +```python +x = 1_00_00_00 +print(x) +``` diff --git a/assets/images/numeric_value_with_underscores/integer_example.gif b/assets/images/numeric_value_with_underscores/integer_example.gif new file mode 100644 index 0000000..f1eb42b Binary files /dev/null and b/assets/images/numeric_value_with_underscores/integer_example.gif differ