How does python e represent

coldplay.xixi
Release: 2023-01-03 09:26:58
Original
39762 people have browsed it

Python e representation method: use the [exp()] method, the code is [import math;math.exp(x);], [exp()] cannot be accessed directly, and the math module needs to be imported. , calling this method through a static object.

How does python e represent

The operating environment of this tutorial: Windows 7 system, python version 3.9, DELL G3 computer.

Python e representation method:

exp() method returns the exponent of x, ex.

Syntax

The following is the syntax of the exp() method:

import math
math.exp( x )
Copy after login

Note: exp() cannot be accessed directly Yes, you need to import the math module and call this method through a static object.

Parameters

x -- Numeric expression.

Return value

Returns the exponent of x, ex.

Example

The following shows an example of using the exp() method:

#!/usr/bin/python
import math   # 导入 math 模块
print "math.exp(-45.17) : ", math.exp(-45.17)
print "math.exp(100.12) : ", math.exp(100.12)
print "math.exp(100.72) : ", math.exp(100.72)
print "math.exp(119L) : ", math.exp(119L)
print "math.exp(math.pi) : ", math.exp(math.pi)
Copy after login

The output result after running the above example is:

math.exp(-45.17) :  2.41500621326e-20
math.exp(100.12) :  3.03084361407e+43
math.exp(100.72) :  5.52255713025e+43
math.exp(119L) :  4.7978133273e+51
math.exp(math.pi) :  23.1406926328
Copy after login

Related free learning recommendations: python video tutorial

The above is the detailed content of How does python e represent. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!