Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs

Python exp

by suresh

The Python exp math function is used to calculate the power of E, Where E is Euler’s number approximately equal to 2.71828. In this section, we discuss how to use exp function in Python Programming language with example.

The syntax of the exp Function in Python is

math.exp(number);

It can be a number or a valid numerical expression that represents the Python exponent value. If the number argument is a positive or negative number, exp function returns the output. And If it is not a number, exp function returns TypeError.

Python exp Function Example

The exp Function calculates the power of Euler’s number E. In this exp example, We are going to find the exponential check values of different data types and display the output.

# Python EXP Function

import math

Tup = (1.98, 20.26, 13.05, -40.95 , 0.45) # Tuple Declaration
Lis = [-10.98, 3.65, -9.59, -4.15 , 5.97] # List Declaration

print('EXP() Function on Positive Number = %.2f' %math.exp(1))
print('EXP() Function on Negative Number = %.2f' %math.exp(-1))

print('EXP() Function on Tuple Item = %.2f' %math.exp(Tup[2]))
print('EXP() Function on List Item = %.4f' %math.exp(Lis[2]))

print('EXP() Function on Multiple Number = %.4f' %math.exp(10 + 20 - 15.65))

print('EXP() Function on String Number = ', math.exp('Python'))
Python EXP Function
  1. Within the first two statements, we used the Python exp Function with both the Positive integer and negative integer values as arguments.
  2. Next two statements, We used the exp Function on Tuple and List items. If you observe the above Python screenshot, this Math function is working perfectly on them.
  3. We tried Python exponential Function directly on multiple values.
  4. In the last statement, we used the Python exponential Function on the String value, and it returns TypeError.

Placed Under: Python

  • Download and Install Python
  • Python Arithmetic Operators
  • Python Assignment Operators
  • Python Bitwise Operators
  • Python Comparison Operators
  • Python Logical Operators
  • Python If Statement
  • Python If Else
  • Python Elif Statement
  • Python Nested If
  • Python For Loop
  • Python While Loop
  • Python Break
  • Python Continue
  • Python Dictionary
  • Python datetime
  • Python String
  • Python Set
  • Python Tuple
  • Python List
  • Python List Comprehensions
  • Python Lambda Function
  • Python Functions
  • Python Types of Functions
  • Python Iterator
  • Python File Handling
  • Python Directory
  • Python Class
  • Python classmethod
  • Python Inheritance
  • Python Method Overriding
  • Python Static Method
  • Connect Python and SQL Server
  • Python SQL Create DB
  • Python SQL Select Top
  • Python SQL Where Clause
  • Python SQL Order By
  • Python SQL Select Statement
  • Python len Function
  • Python max Function
  • Python map Function
  • Python print Function
  • Python sort Function
  • Python range Function
  • Python zip Function
  • Python Math Functions
  • Python String Functions
  • Python List Functions
  • Python NumPy Array
  • NumPy Aggregate Functions
  • NumPy Arithmetic Operations
  • Python Numpy Bitwise operators
  • Numpy Comparison Operators
  • Numpy Exponential Functions
  • Python Numpy logical operators
  • Python numpy String Functions
  • NumPy Trigonometric Functions
  • Python random Array
  • Python numpy concatenate
  • Python numpy Array shape
  • Python pandas DataFrame
  • Pandas DataFrame plot
  • Python Series
  • Python matplotlib Histogram
  • Python matplotlib Scatter Plot
  • Python matplotlib Pie Chart
  • Python matplotlib Bar Chart
  • Python List Length
  • Python sort List Function
  • Python String Concatenation
  • Python String Length
  • Python substring
  • Python Programming Examples

Copyright © 2021 · All Rights Reserved by Suresh

About Us | Contact Us | Privacy Policy