SlideShare a Scribd company logo
BUILT-IN-FUNCTION
IN PYTHON
By
MAADHESH P
I MCA
BUILT-IN
FUNCTION
The built-in function
are pre defined
functions, there are
68 Library function in
python, these
function perform a
Specific tasks and
can be used in
program.
Built-In-function python basics pre defined function
abs() function
• The python abs() function used to return the
absolute value of a number.
• The argument can be integer and floating
point number.
• It takes only one argument, a number whose
absolute value is to be returned.
E x a m p l e :
a = - 2 0
p r i n t ( ‘ A b s o l u t e v a l u e o f - 2 0 i s : ’ , a b s ( a ) )
b = - 2 0 . 8 3
p r i n t ( ‘ A b s o l u t e v a l u e o f - 2 0 . 8 3 i s : ’ , a b s ( b ) )
O u t p u t :
Absolute value of -20 is: 20
Absolute value of -20.83 is: 20.83
bin() function
The python bin() function is used to return the
binary representation of a specific integer. A
result always starts with the prefix 0b.
E x a m p l e :
x = 1 0
y = b i n ( x )
p r i n t ( y )
O u t p u t :
0 b 1 0 1 0
bool() function
The python bool() converts a value to
Boolean (true or false) using the standard truth
Testing procedure.
E x a m p l e :
t e s t 1 = [ ]
p r i n t ( t e s t 1 , ’ i s ’ , b o o l ( t e s t 1 ) )
t e s t 2 = [ 1 ]
p r i n t ( t e s t 2 , ’ i s ’ , b o o l ( t e s t 2 ) )
O u t p u t :
[ ] i s f a l s e
[ 1 ] i s t r u e
sum() function
As the name says, python sum() function is
used to get the sum of numbers of an iterable.
E x a m p l e :
s = s u m ( [ 1 , 2 , 3 ] )
p r i n t ( s )
s 1 = s u m ( [ s ] , 1 0 )
p r i n t ( s 1 )
O u t p u t :
6
1 6
help() function
• Python help()function is used to get help
Related to the object passed during the call.
• It takes an optional parameter and returns
help information.
• It shows the python help console.It internally
calls python’s help function.
E x a m p l e :
i n f o = h e l p ( )
p r i n t ( i n f o )
O u t p u t :
W e l c o m e t o P y t h o n 3 . 1 !
T h i s i s t h e o n l i n e h e l p u t i l i t y .
len() function
The python len() function is used to return the
length (the number of items) of an object
E x a m p l e :
s t r A = ‘ P y t h o n ’
p r i n t ( l e n ( s t r A ) )
O u t p u t :
6
min() function
• Python min() function is used to get the
smallest element from the collection.
• This function takes two arguments, first is a
collection of elements and second is key, and
returns the smallest element from the collect.
E x a m p l e :
s m a l l = m i n ( 1 8 , 0 7 , 4 5 , 1 7 )
s m a l l 1 = m i n ( 1 8 . 2 5 , 1 8 . 2 4 , 1 8 . 2 3 )
O u t p u t :
0 7
1 8 . 2 3
pow() function
• The python pow() function is used to compute
the power of a number. It returns x to the
power of y.
• If the third arguments(z) is given, it returns x
to the power of y modules z.
E x a m p l e :
p r i n t ( p o w ( 2 , 3 ) )
p r i n t ( p o w ( - 2 , 3 ) )
p r i n t ( p o w ( 2 , - 3 ) )
p r i n t ( p o w ( - 2 , - 3 ) )
O u t p u t :
8
- 8
0 . 1 2 5
- 0 . 1 2 5
print() function
The python print() function prints the given
object to the screen or other standard output
devices.
E x a m p l e :
x , y, z = " a p p l e " , " b a n a n a " , " C h e r r y "
p r i n t ( x , y, z , s e p = ‘ , ’ , e n d = ‘ . ’ )
a = b = c = " a p p l e "
p r i n t ( a , b , c , s e p = ‘ , ’ , e n d = ‘ . ’ )
O u t p u t :
a p p l e , b a n a n a , C h e r r y .
a p p l e , a p p l e , a p p l e .
range() function
• The python range() function return as
immutable sequence of numbers starting from
0 by default.
• Increments by 1(by default) and ends at a
specified number.
E x a m p l e :
p r i n t ( l i s t ( r a n g e ( 0 ) ) )
p r i n t ( l i s t ( r a n g e ( 4 ) ) )
p r i n t ( l i s t ( r a n g e ( 1 , 7 ) ) )
O u t p u t :
[ ]
[ 0 , 1 , 2 , 3 ]
[ 1 , 2 , 3 , 4 , 5 , 6 ]
round() function
The python round() function rounds off the
digits of a number and returns the floating
point numbers.
E x a m p l e :
p r i n t ( r o u n d ( 1 0 . 4 ) )
p r i n t ( r o u n d ( 1 7 . 7 ) )
O u t p u t :
1 0
1 8
type() function
The python type() returns the type of the
specified object if a single argument is
passed to the type() built in function.
E x a m p l e :
l i s t 1 = [ 4 , 5 ]
p r i n t ( t y p e ( l i s t 1 ) )
d i c t 1 = { 4 : ’ f o u r ’ , 5 : ’ f i v e ’ }
p r i n t ( t y p e ( d i c t 1 ) )
O u t p u t :
< c l a s s ‘ l i s t ’ >
< c l a s s ‘ d i c t ’ >
Ad

More Related Content

Similar to Built-In-function python basics pre defined function (20)

Keep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce PythonKeep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce Python
SushJalai
 
C Programming - Refresher - Part III
C Programming - Refresher - Part IIIC Programming - Refresher - Part III
C Programming - Refresher - Part III
Emertxe Information Technologies Pvt Ltd
 
tuples chapter (1).pdfhsuenduneudhhsbhhd
tuples chapter (1).pdfhsuenduneudhhsbhhdtuples chapter (1).pdfhsuenduneudhhsbhhd
tuples chapter (1).pdfhsuenduneudhhsbhhd
megaladsmegala
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...
Simplilearn
 
funadamentals of python programming language (right from scratch)
funadamentals of python programming language (right from scratch)funadamentals of python programming language (right from scratch)
funadamentals of python programming language (right from scratch)
MdFurquan7
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
g3_nittala
 
Python for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo CruzPython for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo Cruz
rpmcruz
 
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
PyData
 
Time and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptxTime and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptx
dudelover
 
SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel write Python code, get Fortran ...
SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel  write Python code, get Fortran ...SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel  write Python code, get Fortran ...
SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel write Python code, get Fortran ...
South Tyrol Free Software Conference
 
Functions.docx
Functions.docxFunctions.docx
Functions.docx
VandanaGoyal21
 
NUMPY
NUMPY NUMPY
NUMPY
SharmilaChidaravalli
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
simenehanmut
 
Python cheatsheat.pdf
Python cheatsheat.pdfPython cheatsheat.pdf
Python cheatsheat.pdf
HimoZZZ
 
W-334535VBE242 Using Python Libraries.pdf
W-334535VBE242 Using Python Libraries.pdfW-334535VBE242 Using Python Libraries.pdf
W-334535VBE242 Using Python Libraries.pdf
manassingh1509
 
The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196
Mahmoud Samir Fayed
 
Numpy Talk at SIAM
Numpy Talk at SIAMNumpy Talk at SIAM
Numpy Talk at SIAM
Enthought, Inc.
 
Python. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdfPython. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdf
prasenjitghosh1998
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Codemotion
 
Keep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce PythonKeep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce Python
SushJalai
 
tuples chapter (1).pdfhsuenduneudhhsbhhd
tuples chapter (1).pdfhsuenduneudhhsbhhdtuples chapter (1).pdfhsuenduneudhhsbhhd
tuples chapter (1).pdfhsuenduneudhhsbhhd
megaladsmegala
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...
Simplilearn
 
funadamentals of python programming language (right from scratch)
funadamentals of python programming language (right from scratch)funadamentals of python programming language (right from scratch)
funadamentals of python programming language (right from scratch)
MdFurquan7
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
g3_nittala
 
Python for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo CruzPython for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo Cruz
rpmcruz
 
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
PyData
 
Time and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptxTime and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptx
dudelover
 
SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel write Python code, get Fortran ...
SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel  write Python code, get Fortran ...SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel  write Python code, get Fortran ...
SFSCON23 - Emily Bourne Yaman Güçlü - Pyccel write Python code, get Fortran ...
South Tyrol Free Software Conference
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
simenehanmut
 
Python cheatsheat.pdf
Python cheatsheat.pdfPython cheatsheat.pdf
Python cheatsheat.pdf
HimoZZZ
 
W-334535VBE242 Using Python Libraries.pdf
W-334535VBE242 Using Python Libraries.pdfW-334535VBE242 Using Python Libraries.pdf
W-334535VBE242 Using Python Libraries.pdf
manassingh1509
 
The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196
Mahmoud Samir Fayed
 
Python. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdfPython. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdf
prasenjitghosh1998
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Codemotion
 

Recently uploaded (20)

WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
How To Develop A Cryptocurrency Exchange - Slideshare.pptx
How To Develop A Cryptocurrency Exchange - Slideshare.pptxHow To Develop A Cryptocurrency Exchange - Slideshare.pptx
How To Develop A Cryptocurrency Exchange - Slideshare.pptx
laravinson24
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Top 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdfTop 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdf
AffinityCore
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with PrometheusMeet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Eric D. Schabell
 
Navigating EAA Compliance in Testing.pdf
Navigating EAA Compliance in Testing.pdfNavigating EAA Compliance in Testing.pdf
Navigating EAA Compliance in Testing.pdf
Applitools
 
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
saimabibi60507
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
Creating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdfCreating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdf
Applitools
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
GDS SYSTEM | GLOBAL DISTRIBUTION SYSTEM
GDS SYSTEM | GLOBAL  DISTRIBUTION SYSTEMGDS SYSTEM | GLOBAL  DISTRIBUTION SYSTEM
GDS SYSTEM | GLOBAL DISTRIBUTION SYSTEM
philipnathen82
 
A Deep Dive into Odoo CRM: Lead Management, Automation & More
A Deep Dive into Odoo CRM: Lead Management, Automation & MoreA Deep Dive into Odoo CRM: Lead Management, Automation & More
A Deep Dive into Odoo CRM: Lead Management, Automation & More
SatishKumar2651
 
Cryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptxCryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptx
riyageorge2024
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
How To Develop A Cryptocurrency Exchange - Slideshare.pptx
How To Develop A Cryptocurrency Exchange - Slideshare.pptxHow To Develop A Cryptocurrency Exchange - Slideshare.pptx
How To Develop A Cryptocurrency Exchange - Slideshare.pptx
laravinson24
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Top 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdfTop 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdf
AffinityCore
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with PrometheusMeet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Eric D. Schabell
 
Navigating EAA Compliance in Testing.pdf
Navigating EAA Compliance in Testing.pdfNavigating EAA Compliance in Testing.pdf
Navigating EAA Compliance in Testing.pdf
Applitools
 
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
saimabibi60507
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
Creating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdfCreating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdf
Applitools
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
GDS SYSTEM | GLOBAL DISTRIBUTION SYSTEM
GDS SYSTEM | GLOBAL  DISTRIBUTION SYSTEMGDS SYSTEM | GLOBAL  DISTRIBUTION SYSTEM
GDS SYSTEM | GLOBAL DISTRIBUTION SYSTEM
philipnathen82
 
A Deep Dive into Odoo CRM: Lead Management, Automation & More
A Deep Dive into Odoo CRM: Lead Management, Automation & MoreA Deep Dive into Odoo CRM: Lead Management, Automation & More
A Deep Dive into Odoo CRM: Lead Management, Automation & More
SatishKumar2651
 
Cryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptxCryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptx
riyageorge2024
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Ad

Built-In-function python basics pre defined function

  • 2. BUILT-IN FUNCTION The built-in function are pre defined functions, there are 68 Library function in python, these function perform a Specific tasks and can be used in program.
  • 4. abs() function • The python abs() function used to return the absolute value of a number. • The argument can be integer and floating point number. • It takes only one argument, a number whose absolute value is to be returned.
  • 5. E x a m p l e : a = - 2 0 p r i n t ( ‘ A b s o l u t e v a l u e o f - 2 0 i s : ’ , a b s ( a ) ) b = - 2 0 . 8 3 p r i n t ( ‘ A b s o l u t e v a l u e o f - 2 0 . 8 3 i s : ’ , a b s ( b ) ) O u t p u t : Absolute value of -20 is: 20 Absolute value of -20.83 is: 20.83
  • 6. bin() function The python bin() function is used to return the binary representation of a specific integer. A result always starts with the prefix 0b.
  • 7. E x a m p l e : x = 1 0 y = b i n ( x ) p r i n t ( y ) O u t p u t : 0 b 1 0 1 0
  • 8. bool() function The python bool() converts a value to Boolean (true or false) using the standard truth Testing procedure.
  • 9. E x a m p l e : t e s t 1 = [ ] p r i n t ( t e s t 1 , ’ i s ’ , b o o l ( t e s t 1 ) ) t e s t 2 = [ 1 ] p r i n t ( t e s t 2 , ’ i s ’ , b o o l ( t e s t 2 ) ) O u t p u t : [ ] i s f a l s e [ 1 ] i s t r u e
  • 10. sum() function As the name says, python sum() function is used to get the sum of numbers of an iterable.
  • 11. E x a m p l e : s = s u m ( [ 1 , 2 , 3 ] ) p r i n t ( s ) s 1 = s u m ( [ s ] , 1 0 ) p r i n t ( s 1 ) O u t p u t : 6 1 6
  • 12. help() function • Python help()function is used to get help Related to the object passed during the call. • It takes an optional parameter and returns help information. • It shows the python help console.It internally calls python’s help function.
  • 13. E x a m p l e : i n f o = h e l p ( ) p r i n t ( i n f o ) O u t p u t : W e l c o m e t o P y t h o n 3 . 1 ! T h i s i s t h e o n l i n e h e l p u t i l i t y .
  • 14. len() function The python len() function is used to return the length (the number of items) of an object
  • 15. E x a m p l e : s t r A = ‘ P y t h o n ’ p r i n t ( l e n ( s t r A ) ) O u t p u t : 6
  • 16. min() function • Python min() function is used to get the smallest element from the collection. • This function takes two arguments, first is a collection of elements and second is key, and returns the smallest element from the collect.
  • 17. E x a m p l e : s m a l l = m i n ( 1 8 , 0 7 , 4 5 , 1 7 ) s m a l l 1 = m i n ( 1 8 . 2 5 , 1 8 . 2 4 , 1 8 . 2 3 ) O u t p u t : 0 7 1 8 . 2 3
  • 18. pow() function • The python pow() function is used to compute the power of a number. It returns x to the power of y. • If the third arguments(z) is given, it returns x to the power of y modules z.
  • 19. E x a m p l e : p r i n t ( p o w ( 2 , 3 ) ) p r i n t ( p o w ( - 2 , 3 ) ) p r i n t ( p o w ( 2 , - 3 ) ) p r i n t ( p o w ( - 2 , - 3 ) ) O u t p u t : 8 - 8 0 . 1 2 5 - 0 . 1 2 5
  • 20. print() function The python print() function prints the given object to the screen or other standard output devices.
  • 21. E x a m p l e : x , y, z = " a p p l e " , " b a n a n a " , " C h e r r y " p r i n t ( x , y, z , s e p = ‘ , ’ , e n d = ‘ . ’ ) a = b = c = " a p p l e " p r i n t ( a , b , c , s e p = ‘ , ’ , e n d = ‘ . ’ ) O u t p u t : a p p l e , b a n a n a , C h e r r y . a p p l e , a p p l e , a p p l e .
  • 22. range() function • The python range() function return as immutable sequence of numbers starting from 0 by default. • Increments by 1(by default) and ends at a specified number.
  • 23. E x a m p l e : p r i n t ( l i s t ( r a n g e ( 0 ) ) ) p r i n t ( l i s t ( r a n g e ( 4 ) ) ) p r i n t ( l i s t ( r a n g e ( 1 , 7 ) ) ) O u t p u t : [ ] [ 0 , 1 , 2 , 3 ] [ 1 , 2 , 3 , 4 , 5 , 6 ]
  • 24. round() function The python round() function rounds off the digits of a number and returns the floating point numbers.
  • 25. E x a m p l e : p r i n t ( r o u n d ( 1 0 . 4 ) ) p r i n t ( r o u n d ( 1 7 . 7 ) ) O u t p u t : 1 0 1 8
  • 26. type() function The python type() returns the type of the specified object if a single argument is passed to the type() built in function.
  • 27. E x a m p l e : l i s t 1 = [ 4 , 5 ] p r i n t ( t y p e ( l i s t 1 ) ) d i c t 1 = { 4 : ’ f o u r ’ , 5 : ’ f i v e ’ } p r i n t ( t y p e ( d i c t 1 ) ) O u t p u t : < c l a s s ‘ l i s t ’ > < c l a s s ‘ d i c t ’ >