SlideShare a Scribd company logo
http://www.tutorialspoint.com/python/python_numbers.htm Copyright © tutorialspoint.com
PYTHON NUMBERS
Number data types store numeric values. They are immutable data types, whichmeans that changing the value of
a number data type results ina newly allocated object.
Number objects are created whenyouassigna value to them. For example:
var1 = 1
var2 = 10
Youcanalso delete the reference to a number object by using the del statement. The syntax of the delstatement
is:
del var1[,var2[,var3[....,varN]]]]
Youcandelete a single object or multiple objects by using the delstatement. For example:
del var
del var_a, var_b
Pythonsupports four different numericaltypes:
int (signed integers): oftencalled just integers or ints, are positive or negative whole numbers with
no decimalpoint.
long (long integers ): or longs, are integers of unlimited size, writtenlike integers and followed by an
uppercase or lowercase L.
float (floating point real values) : or floats, represent realnumbers and are writtenwitha decimal
point dividing the integer and fractionalparts. Floats may also be inscientific notation, withE or e indicating
the power of 10 (2.5e2 = 2.5 x 102 = 250).
complex (complex numbers) : are of the forma + bJ, where a and b are floats and J (or j)
represents the square root of -1 (whichis animaginary number). a is the realpart of the number, and b is
the imaginary part. Complex numbers are not used muchinPythonprogramming.
Examples:
Here are some examples of numbers:
int long float complex
10 51924361L 0.0 3.14j
100 -0x19323L 15.20 45.j
-786 0122L -21.9 9.322e-36j
080 0xDEFABCECBDAECBFBAEl 32.3+e18 .876j
-0490 535633629843L -90. -.6545+0J
-0x260 -052318172735L -32.54e100 3e+26J
0x69 -4721885298529L 70.2-E12 4.53e-7j
Pythonallows youto use a lowercase L withlong, but it is recommended that youuse only anuppercase L
to avoid confusionwiththe number 1. Pythondisplays long integers withanuppercase L.
A complex number consists of anordered pair of realfloatingpoint numbers denoted by a + bj, where a is
the realpart and b is the imaginary part of the complex number.
Number Type Conversion:
Pythonconverts numbers internally inanexpressioncontaining mixed types to a commontype for evaluation. But
sometimes, you'llneed to coerce a number explicitly fromone type to another to satisfy the requirements of an
operator or functionparameter.
Type int(x)to convert x to a plaininteger.
Type long(x) to convert x to a long integer.
Type float(x) to convert x to a floating-point number.
Type complex(x) to convert x to a complex number withrealpart x and imaginary part zero.
Type complex(x, y) to convert x and y to a complex number withrealpart x and imaginary part y. x and
y are numeric expressions
Mathematical Functions:
Pythonincludes following functions that performmathematicalcalculations.
Function Returns ( description )
abs(x) The absolute value of x: the (positive) distance betweenx and zero.
ceil(x) The ceiling of x: the smallest integer not less thanx
cmp(x, y) -1 if x < y, 0 if x == y, or 1 if x > y
exp(x) The exponentialof x: ex
fabs(x) The absolute value of x.
floor(x) The floor of x: the largest integer not greater thanx
log(x) The naturallogarithmof x, for x> 0
log10(x) The base-10 logarithmof x for x> 0 .
max(x1, x2,...) The largest of its arguments: the value closest to positive infinity
min(x1, x2,...) The smallest of its arguments: the value closest to negative infinity
modf(x) The fractionaland integer parts of x ina two-itemtuple. Bothparts have the same
signas x. The integer part is returned as a float.
pow(x, y) The value of x**y.
round(x [,n]) x rounded to ndigits fromthe decimalpoint. Pythonrounds away fromzero as a
tie-breaker: round(0.5) is 1.0 and round(-0.5) is -1.0.
sqrt(x) The square root of x for x > 0
Random Number Functions:
Randomnumbers are used for games, simulations, testing, security, and privacy applications. Pythonincludes
following functions that are commonly used.
Function Description
choice(seq) A randomitemfroma list, tuple, or string.
randrange ([start,] stop
[,step])
A randomly selected element fromrange(start, stop, step)
random() A randomfloat r, suchthat 0 is less thanor equalto r and r is less than1
seed([x]) Sets the integer starting value used ingenerating randomnumbers. Callthis
functionbefore calling any other randommodule function. Returns None.
shuffle(lst) Randomizes the items of a list inplace. Returns None.
uniform(x, y) A randomfloat r, suchthat x is less thanor equalto r and r is less thany
Trigonometric Functions:
Pythonincludes following functions that performtrigonometric calculations.
Function Description
acos(x) Returnthe arc cosine of x, inradians.
asin(x) Returnthe arc sine of x, inradians.
atan(x) Returnthe arc tangent of x, inradians.
atan2(y, x) Returnatan(y / x), inradians.
cos(x) Returnthe cosine of x radians.
hypot(x, y) Returnthe Euclideannorm, sqrt(x*x + y*y).
sin(x) Returnthe sine of x radians.
tan(x) Returnthe tangent of x radians.
degrees(x) Converts angle x fromradians to degrees.
radians(x) Converts angle x fromdegrees to radians.
Mathematical Constants:
The module also defines two mathematicalconstants:
Constants Description
pi The mathematicalconstant pi.
e The mathematicalconstant e.

More Related Content

What's hot

Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
eShikshak
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
Samir Mohanty
 
Python basics
Python basicsPython basics
Python basics
RANAALIMAJEEDRAJPUT
 
programming with python ppt
programming with python pptprogramming with python ppt
programming with python ppt
Priyanka Pradhan
 
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Edureka!
 
Python basics
Python basicsPython basics
Python basics
Jyoti shukla
 
Python final ppt
Python final pptPython final ppt
Python final ppt
Ripal Ranpara
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
TMARAGATHAM
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
University of Technology
 
Python strings presentation
Python strings presentationPython strings presentation
Python strings presentation
VedaGayathri1
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
RaginiJain21
 
Inline function
Inline functionInline function
Inline function
Tech_MX
 
Python basic
Python basicPython basic
Python basic
Saifuddin Kaijar
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
amiable_indian
 
Python ppt
Python pptPython ppt
Python ppt
Rachit Bhargava
 
Networking in python by Rj
Networking in python by RjNetworking in python by Rj
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
Rasan Samarasinghe
 
Function in Python
Function in PythonFunction in Python
Function in Python
Yashdev Hada
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
narmadhakin
 
File handling in Python
File handling in PythonFile handling in Python

What's hot (20)

Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
 
Python basics
Python basicsPython basics
Python basics
 
programming with python ppt
programming with python pptprogramming with python ppt
programming with python ppt
 
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
 
Python basics
Python basicsPython basics
Python basics
 
Python final ppt
Python final pptPython final ppt
Python final ppt
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
Python strings presentation
Python strings presentationPython strings presentation
Python strings presentation
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
 
Inline function
Inline functionInline function
Inline function
 
Python basic
Python basicPython basic
Python basic
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Python ppt
Python pptPython ppt
Python ppt
 
Networking in python by Rj
Networking in python by RjNetworking in python by Rj
Networking in python by Rj
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Function in Python
Function in PythonFunction in Python
Function in Python
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 

Similar to Python numbers

python
pythonpython
python
ultragamer6
 
Python programming unit 2 -Slides-3.ppt
Python programming  unit 2 -Slides-3.pptPython programming  unit 2 -Slides-3.ppt
Python programming unit 2 -Slides-3.ppt
geethar79
 
Python-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptxPython-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptx
ElijahSantos4
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptx
lemonchoos
 
GRADE 11 Chapter 5 - Python Fundamentals.pptx
GRADE 11 Chapter 5 - Python Fundamentals.pptxGRADE 11 Chapter 5 - Python Fundamentals.pptx
GRADE 11 Chapter 5 - Python Fundamentals.pptx
DeepaRavi21
 
Python PPT2
Python PPT2Python PPT2
Python PPT2
Selvakanmani S
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
Ankita Shirke
 
Python basics
Python basicsPython basics
Python basics
Manisha Gholve
 
CS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfCS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdf
Ida Lumintu
 
Python - variable types
Python - variable typesPython - variable types
Python - variable types
Learnbay Datascience
 
Python ppt
Python pptPython ppt
Python ppt
Anush verma
 
JavaScript number object.pptx
JavaScript number object.pptxJavaScript number object.pptx
JavaScript number object.pptx
Steins18
 
Introduction to C Programming - R.D.Sivakumar
Introduction to C Programming -  R.D.SivakumarIntroduction to C Programming -  R.D.Sivakumar
Introduction to C Programming - R.D.Sivakumar
Sivakumar R D .
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
Sujith Kumar
 
Python
PythonPython
Python slide.1
Python slide.1Python slide.1
Python slide.1
Aswin Krishnamoorthy
 
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxCS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
faithxdunce63732
 
Let Us Learn Lambda Using C# 3.0
Let Us Learn Lambda Using C# 3.0Let Us Learn Lambda Using C# 3.0
Let Us Learn Lambda Using C# 3.0
Sheik Uduman Ali
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
MaheshPandit16
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
jovannyflex
 

Similar to Python numbers (20)

python
pythonpython
python
 
Python programming unit 2 -Slides-3.ppt
Python programming  unit 2 -Slides-3.pptPython programming  unit 2 -Slides-3.ppt
Python programming unit 2 -Slides-3.ppt
 
Python-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptxPython-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptx
 
IMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptxIMP PPT- Python programming fundamentals.pptx
IMP PPT- Python programming fundamentals.pptx
 
GRADE 11 Chapter 5 - Python Fundamentals.pptx
GRADE 11 Chapter 5 - Python Fundamentals.pptxGRADE 11 Chapter 5 - Python Fundamentals.pptx
GRADE 11 Chapter 5 - Python Fundamentals.pptx
 
Python PPT2
Python PPT2Python PPT2
Python PPT2
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
Python basics
Python basicsPython basics
Python basics
 
CS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfCS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdf
 
Python - variable types
Python - variable typesPython - variable types
Python - variable types
 
Python ppt
Python pptPython ppt
Python ppt
 
JavaScript number object.pptx
JavaScript number object.pptxJavaScript number object.pptx
JavaScript number object.pptx
 
Introduction to C Programming - R.D.Sivakumar
Introduction to C Programming -  R.D.SivakumarIntroduction to C Programming -  R.D.Sivakumar
Introduction to C Programming - R.D.Sivakumar
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
Python
PythonPython
Python
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxCS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
 
Let Us Learn Lambda Using C# 3.0
Let Us Learn Lambda Using C# 3.0Let Us Learn Lambda Using C# 3.0
Let Us Learn Lambda Using C# 3.0
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
 

More from Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai

Artificial Intelligence (AI) application in Agriculture Area
Artificial Intelligence (AI) application in Agriculture Area Artificial Intelligence (AI) application in Agriculture Area
Artificial Intelligence (AI) application in Agriculture Area
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
VLSI Design Book CMOS_Circuit_Design__Layout__and_Simulation
VLSI Design Book CMOS_Circuit_Design__Layout__and_SimulationVLSI Design Book CMOS_Circuit_Design__Layout__and_Simulation
VLSI Design Book CMOS_Circuit_Design__Layout__and_Simulation
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Question Bank: Network Management in Telecommunication
Question Bank: Network Management in TelecommunicationQuestion Bank: Network Management in Telecommunication
Question Bank: Network Management in Telecommunication
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
INTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdf
INTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdfINTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdf
INTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdf
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
LRU_Replacement-Policy.pdf
LRU_Replacement-Policy.pdfLRU_Replacement-Policy.pdf
Network Management Principles and Practice - 2nd Edition (2010)_2.pdf
Network Management Principles and Practice - 2nd Edition (2010)_2.pdfNetwork Management Principles and Practice - 2nd Edition (2010)_2.pdf
Network Management Principles and Practice - 2nd Edition (2010)_2.pdf
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Euler Method Details
Euler Method Details Euler Method Details
Mini Project fo BE Engineering students
Mini Project fo BE Engineering  students  Mini Project fo BE Engineering  students
Mini Project fo BE Engineering students
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Mini Project for Engineering Students BE or Btech Engineering students
Mini Project for Engineering Students BE or Btech Engineering students Mini Project for Engineering Students BE or Btech Engineering students
Mini Project for Engineering Students BE or Btech Engineering students
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Ballistics Detsils
Ballistics Detsils Ballistics Detsils
VLSI Design_LAB MANUAL By Umakant Gohatre
VLSI Design_LAB MANUAL By Umakant GohatreVLSI Design_LAB MANUAL By Umakant Gohatre
VLSI Design_LAB MANUAL By Umakant Gohatre
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Cryptography and Network Security
Cryptography and Network SecurityCryptography and Network Security
cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre
cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre
cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Image Compression, Introduction Data Compression/ Data compression, modelling...
Image Compression, Introduction Data Compression/ Data compression, modelling...Image Compression, Introduction Data Compression/ Data compression, modelling...
Image Compression, Introduction Data Compression/ Data compression, modelling...
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Introduction Data Compression/ Data compression, modelling and coding,Image C...
Introduction Data Compression/ Data compression, modelling and coding,Image C...Introduction Data Compression/ Data compression, modelling and coding,Image C...
Introduction Data Compression/ Data compression, modelling and coding,Image C...
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Python overview
Python overviewPython overview
Python networking
Python networkingPython networking
Python multithreading
Python multithreadingPython multithreading
Python modules
Python modulesPython modules
Python loops
Python loopsPython loops

More from Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai (20)

Artificial Intelligence (AI) application in Agriculture Area
Artificial Intelligence (AI) application in Agriculture Area Artificial Intelligence (AI) application in Agriculture Area
Artificial Intelligence (AI) application in Agriculture Area
 
VLSI Design Book CMOS_Circuit_Design__Layout__and_Simulation
VLSI Design Book CMOS_Circuit_Design__Layout__and_SimulationVLSI Design Book CMOS_Circuit_Design__Layout__and_Simulation
VLSI Design Book CMOS_Circuit_Design__Layout__and_Simulation
 
Question Bank: Network Management in Telecommunication
Question Bank: Network Management in TelecommunicationQuestion Bank: Network Management in Telecommunication
Question Bank: Network Management in Telecommunication
 
INTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdf
INTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdfINTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdf
INTRODUCTION TO CYBER LAW The Concept of Cyberspace Cyber law Cyber crime.pdf
 
LRU_Replacement-Policy.pdf
LRU_Replacement-Policy.pdfLRU_Replacement-Policy.pdf
LRU_Replacement-Policy.pdf
 
Network Management Principles and Practice - 2nd Edition (2010)_2.pdf
Network Management Principles and Practice - 2nd Edition (2010)_2.pdfNetwork Management Principles and Practice - 2nd Edition (2010)_2.pdf
Network Management Principles and Practice - 2nd Edition (2010)_2.pdf
 
Euler Method Details
Euler Method Details Euler Method Details
Euler Method Details
 
Mini Project fo BE Engineering students
Mini Project fo BE Engineering  students  Mini Project fo BE Engineering  students
Mini Project fo BE Engineering students
 
Mini Project for Engineering Students BE or Btech Engineering students
Mini Project for Engineering Students BE or Btech Engineering students Mini Project for Engineering Students BE or Btech Engineering students
Mini Project for Engineering Students BE or Btech Engineering students
 
Ballistics Detsils
Ballistics Detsils Ballistics Detsils
Ballistics Detsils
 
VLSI Design_LAB MANUAL By Umakant Gohatre
VLSI Design_LAB MANUAL By Umakant GohatreVLSI Design_LAB MANUAL By Umakant Gohatre
VLSI Design_LAB MANUAL By Umakant Gohatre
 
Cryptography and Network Security
Cryptography and Network SecurityCryptography and Network Security
Cryptography and Network Security
 
cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre
cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre
cyber crime, Cyber Security, Introduction, Umakant Bhaskar Gohatre
 
Image Compression, Introduction Data Compression/ Data compression, modelling...
Image Compression, Introduction Data Compression/ Data compression, modelling...Image Compression, Introduction Data Compression/ Data compression, modelling...
Image Compression, Introduction Data Compression/ Data compression, modelling...
 
Introduction Data Compression/ Data compression, modelling and coding,Image C...
Introduction Data Compression/ Data compression, modelling and coding,Image C...Introduction Data Compression/ Data compression, modelling and coding,Image C...
Introduction Data Compression/ Data compression, modelling and coding,Image C...
 
Python overview
Python overviewPython overview
Python overview
 
Python networking
Python networkingPython networking
Python networking
 
Python multithreading
Python multithreadingPython multithreading
Python multithreading
 
Python modules
Python modulesPython modules
Python modules
 
Python loops
Python loopsPython loops
Python loops
 

Recently uploaded

CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
mamamaam477
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 

Recently uploaded (20)

CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 

Python numbers

  • 1. http://www.tutorialspoint.com/python/python_numbers.htm Copyright © tutorialspoint.com PYTHON NUMBERS Number data types store numeric values. They are immutable data types, whichmeans that changing the value of a number data type results ina newly allocated object. Number objects are created whenyouassigna value to them. For example: var1 = 1 var2 = 10 Youcanalso delete the reference to a number object by using the del statement. The syntax of the delstatement is: del var1[,var2[,var3[....,varN]]]] Youcandelete a single object or multiple objects by using the delstatement. For example: del var del var_a, var_b Pythonsupports four different numericaltypes: int (signed integers): oftencalled just integers or ints, are positive or negative whole numbers with no decimalpoint. long (long integers ): or longs, are integers of unlimited size, writtenlike integers and followed by an uppercase or lowercase L. float (floating point real values) : or floats, represent realnumbers and are writtenwitha decimal point dividing the integer and fractionalparts. Floats may also be inscientific notation, withE or e indicating the power of 10 (2.5e2 = 2.5 x 102 = 250). complex (complex numbers) : are of the forma + bJ, where a and b are floats and J (or j) represents the square root of -1 (whichis animaginary number). a is the realpart of the number, and b is the imaginary part. Complex numbers are not used muchinPythonprogramming. Examples: Here are some examples of numbers: int long float complex 10 51924361L 0.0 3.14j 100 -0x19323L 15.20 45.j -786 0122L -21.9 9.322e-36j 080 0xDEFABCECBDAECBFBAEl 32.3+e18 .876j -0490 535633629843L -90. -.6545+0J -0x260 -052318172735L -32.54e100 3e+26J 0x69 -4721885298529L 70.2-E12 4.53e-7j Pythonallows youto use a lowercase L withlong, but it is recommended that youuse only anuppercase L to avoid confusionwiththe number 1. Pythondisplays long integers withanuppercase L.
  • 2. A complex number consists of anordered pair of realfloatingpoint numbers denoted by a + bj, where a is the realpart and b is the imaginary part of the complex number. Number Type Conversion: Pythonconverts numbers internally inanexpressioncontaining mixed types to a commontype for evaluation. But sometimes, you'llneed to coerce a number explicitly fromone type to another to satisfy the requirements of an operator or functionparameter. Type int(x)to convert x to a plaininteger. Type long(x) to convert x to a long integer. Type float(x) to convert x to a floating-point number. Type complex(x) to convert x to a complex number withrealpart x and imaginary part zero. Type complex(x, y) to convert x and y to a complex number withrealpart x and imaginary part y. x and y are numeric expressions Mathematical Functions: Pythonincludes following functions that performmathematicalcalculations. Function Returns ( description ) abs(x) The absolute value of x: the (positive) distance betweenx and zero. ceil(x) The ceiling of x: the smallest integer not less thanx cmp(x, y) -1 if x < y, 0 if x == y, or 1 if x > y exp(x) The exponentialof x: ex fabs(x) The absolute value of x. floor(x) The floor of x: the largest integer not greater thanx log(x) The naturallogarithmof x, for x> 0 log10(x) The base-10 logarithmof x for x> 0 . max(x1, x2,...) The largest of its arguments: the value closest to positive infinity min(x1, x2,...) The smallest of its arguments: the value closest to negative infinity modf(x) The fractionaland integer parts of x ina two-itemtuple. Bothparts have the same signas x. The integer part is returned as a float. pow(x, y) The value of x**y. round(x [,n]) x rounded to ndigits fromthe decimalpoint. Pythonrounds away fromzero as a tie-breaker: round(0.5) is 1.0 and round(-0.5) is -1.0. sqrt(x) The square root of x for x > 0 Random Number Functions: Randomnumbers are used for games, simulations, testing, security, and privacy applications. Pythonincludes following functions that are commonly used.
  • 3. Function Description choice(seq) A randomitemfroma list, tuple, or string. randrange ([start,] stop [,step]) A randomly selected element fromrange(start, stop, step) random() A randomfloat r, suchthat 0 is less thanor equalto r and r is less than1 seed([x]) Sets the integer starting value used ingenerating randomnumbers. Callthis functionbefore calling any other randommodule function. Returns None. shuffle(lst) Randomizes the items of a list inplace. Returns None. uniform(x, y) A randomfloat r, suchthat x is less thanor equalto r and r is less thany Trigonometric Functions: Pythonincludes following functions that performtrigonometric calculations. Function Description acos(x) Returnthe arc cosine of x, inradians. asin(x) Returnthe arc sine of x, inradians. atan(x) Returnthe arc tangent of x, inradians. atan2(y, x) Returnatan(y / x), inradians. cos(x) Returnthe cosine of x radians. hypot(x, y) Returnthe Euclideannorm, sqrt(x*x + y*y). sin(x) Returnthe sine of x radians. tan(x) Returnthe tangent of x radians. degrees(x) Converts angle x fromradians to degrees. radians(x) Converts angle x fromdegrees to radians. Mathematical Constants: The module also defines two mathematicalconstants: Constants Description pi The mathematicalconstant pi. e The mathematicalconstant e.