Open In App

Python Program to Convert Float to Exponential

Last Updated : 13 Dec, 2025
Comments
Improve
Suggest changes
1 Likes
Like
Report

Given a floating-point number, the task is to convert it into its exponential (scientific) notation format.

For Example:

Input: float = 200.2
Output: 2.002000e+02

Let’s explore different methods to convert a float to exponential.

Using f-strings

This method formats the float directly inside an f-string using the ":e" format specifier, which converts the numeric value into exponential notation.

Python
n = 1101.02
res = f"{n:e}"
print(res)

Output
1.101020e+03

Explanation: f"{n:e}" applies the e format code on the value of n, producing exponential form. 

Using format()

This method uses the built-in format() function, passing the float and the "e" format code, which instructs Python to produce exponential notation.

Python
n = 1101.02
res = format(n, "e")
print(res)

Output
1.101020e+03

Explanation: format(n, "e") converts n using the "e" formatting token.

Using str.format()

The placeholder {:e} is placed inside the string, and .format() supplies the float value, causing the conversion to exponential form.

Python
n = 1101.02
res = "{:e}".format(n)
print(res)

Output
1.101020e+03

Explanation:

  • "{:e}" indicates that the inserted value should use exponential formatting.
  • .format(n) inserts the value into the placeholder and applies the format code.

Using Uppercase Scientific Notation

Using "E" instead of "e" formats the float into exponential notation with an uppercase exponent symbol.

Python
n = 1101.02
res = f"{n:E}"
print(res)

Output
1.101020E+03

Explanation: "E" formats the number like "e" but produces output in E+XX format.


Explore