  # Python | Decimal method to_eng_string ()

Python Methods and Functions | String Variables

Decimal # to_eng_string (): to_eng_string () — it is a Decimal method that converts to a string using engineering notation if exponent is required.

Syntax: Decimal.to_eng_string()

Parameter: Decimal values ​​

Return: converts to a string

Code # 1: Example for to_eng_string () method

 ` # Python program explaining ` ` # to_eng_string ( ) method `   ` # loading decimal library ` ` from ` ` decimal ` ` import ` ` * `     ` # Initialize decimal value ` a ` = ` ` Decimal (` ` 1.898989 ` `) `   ` b ` ` = ` ` Decimal (` ` 2.0 ` `) ` ` `  ` # print decimal values ​​` ` print ` ` (` ` "Decimal value a:" ` `, a) ` ` print ` ` (` ` "Decimal value b:" ` `, b) `     ` # Using the Decimal.to_eng_string () method ` ` print ` < code class = "plain"> ( ` "Decimal a with to_eng_string () method:" ` `, a.to_eng_string ()) `   ` print ` ` (` ` "Decimal b with to_eng_string () method:" ` `, b.to_eng_string ()) `

Output:

``` Decimal value a : 1.8989890000000000380708797820261679589748382568359375 Decimal value b: 2 Decimal a with to_eng_string () method: 1.8989890000000000380708797820261679589748382568359375 Decimal b with to_eng_string () # method: 2_bpre> Code  Code / p>         Output:   Decimal value a: 3.140000000000000124344978758017532527446746826171875 Decimal value b: 15 Decimal a with to_eng_string () method: 3.140000000000000124344978758017532527446746826171875 Decimal b with to_eng_string () method: 15

Books for developers

Learn Python the hard way
In Learn Python 3 the Hard Way PDF, you'll learn Python by working through 52 brilliantly crafted exercises. Read them. Enter your code exactly. (No copying and pasting!) Correct your mistakes. ...
05/09/2021

Learning Python, 5th Edition
Mark Lutz is the global leader in Python training, author of the oldest and best-selling Python texts, and a pioneer in the Python community since 1992.
Mark Lutz is the author of the found...
11/08/2021

Big Data Concepts, Theories, and Applications
The rate at which we produce data is growing steadily, thus creating even larger streams of continuously evolving data. Online news, micro-blogs, search queries are just a few examples of these contin...
10/07/2020

Getting Started with Greenplum for Big Data Analytics
In the last decade, we have seen the impact of exponential advances in technology on the way we work, shop, communicate, and think. At the heart of this change is our ability to collect and gain insig...
10/07/2020 Best Python tutorials books for beginners and professionals

Python.Engineering is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com
Python in Italiano
Python auf Deutsch
Python en Français
Python en Español
Türk dilinde Python
Python: мануалы на русском

Computations
Development
Cryptography
For dummies
Machine Learning
Big Data
Loops
Counters

NumPy
NLP
PHP
Regular Expressions
File Handling
Arrays
String Variables
Knowledge Database

X
Submit new EBook

` # Python program explaining `  ` # to_eng_string () method `   ` `  ` # decimal library loading `   ` from ` ` decimal ` ` import ` ` * `      ` `  ` # Initialize decimal value `   ` a ` ` = ` ` Decimal (` ` 3.14 ` `) `  ` `   ` b ` ` = ` ` Decimal (` ` 15 ` `) `       ` # print decimal values ​​`   ` print ` ` (  "Decimal value a:"  , a) ``   print   (  "Decimal value b:"  , b)          # Using the Decimal.to_eng_string () method     print   (  "Decimal a with to_eng_string () method:"  , a.to_eng_string ())        print   ( " Decimal b with to_eng_string () method: " , b.to_eng_string ()) `

\$(".modal_galery").owlCarousel({
items: 1,
itemsCustom: false,
itemsDesktop: [1300, 1],
itemsDesktopSmall: [960, 1],
itemsTablet: [768, 1],
itemsTabletSmall: false,
itemsMobile: [479, 1],
singleItem: false,
itemsScaleUp: false,
pagination: false,
rewindNav: true,
autoPlay: true,
stopOnHover: true,
"<img class='img_no_nav_mob' src='/wp-content/themes/nimani/image/prevCopy.png'>",
"<img class='img_no_nav_mob' src='/wp-content/themes/nimani/image/nextCopy.png'>"
],
});