M
M
micr02017-12-12 23:02:15
Python
micr0, 2017-12-12 23:02:15

How to represent a number in exponential form?

I have a very large number, 20000! (where ! is the factorial). I need to write it in exponential form. I know that there is a toExponential method in java script language that solves my problem. Please tell me a similar function for Python.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2017-12-12
@micr0

import math, decimal
 
f = decimal.Decimal(math.factorial(20000))
print(format(f, '.2e'))
https://ideone.com/gYrMTu

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question