SlideShare a Scribd company logo
2
Most read
4
Most read
Python Built-in Functions
and Use cases
Srajan Mor
Integers
Purpose:
Digital computer can only process data that
has been expressed in binary format. That is
to say 0 or 1, which can be expressed
electronically as On/Off.
For Information technology applications, the
amount of information being processed is an
important design consideration.
The term bit-length is a technical shorthand
for this measure.
bit_length() method in python tell us the
Number of bits necessary to represent an
integer in binary number.
.bit_length()
Use Cases
Integers
Purpose:
Not only real numbers, Python can also
handle complex numbers and its associated
functions.
Complex numbers have their uses in many
applications related to mathematics and
python provides useful tools to handle and
manipulate them.
Complex numbers are expressed as
combination of real and imaginary part.
Complex number = a + bi
Where ‘a’ is the real part and ‘bi’ is the
imaginary part.
Since integers are real numbers only, they
will always return 0 when using .imag().
.real() and .imag()
Use Cases
Integers
Purpose:
Whenever we are dealing with complex
numbers we can use this function.
This function basically removes the
parenthesis from an integer.
.conjugate()
Use Cases
.numerator()
.denominator()
Purpose:
These function return the numerator and
denominator from an integer.
Since integers are without any decimals, so
the denominator will always be 1.
Strings
Purpose:
At some point, we may need to beak a large
string into smaller chunks or strings. This is
opposite of concatenation which merges or
combines string into one.
To do this, we use the split function. It breaks
the given string by the specified separator
and then returns the output in form of a list.
We need to specify a delimiter as the
separator. If we do not define a delimiter,
then python will split the string assuming
whitespace as a separator.
We can also define how many times we
need python to split the string. By default
there is no limit.
.split()
Use Cases
Strings
Purpose:
This function returns the capitalized version
of a string. We need to note that it only
capitalizes the first letter of the string.
.capitalize()
Use Cases
.lower() and .upper()
Purpose:
.lower() function returns the entire string in a
lower case.
.upper() function returns the entire string in
upper case.
Strings
Purpose:
This method formats the specified value and
inserts them inside the string’s placeholder.
A placeholder is defined using curly brackets:
{}. Placeholder tell the format method the
location where we need to insert a specific
value.
We can have multiple placeholder in a string
in which we can have multiple values.
This method is particularly useful when we
need to pass something inside a string which
is changing or is calculated.
.format()
Use Cases
Float
Purpose:
This function returns a pair of integer whose
ratio is exactly equal to the original float and
with a positive denominator. Note that is
returns the result in tuple.
.as_integer_ratio()
Use Cases
.hex() and .fromhex()
Purpose:
.hex() function returns the hexadecimal
representation of a floating point number.
.fromhex() creates a floating point number
from a hexadecimal string.
Float
Purpose:
This function checks whether the value
stored is an integer of not. Returns true if it
is.
.is_integer()
Use Cases
.imag() and .real()
Purpose:
Complex numbers are expressed as
combination of real and imaginary part.
Complex number = a + bi
Where ‘a’ is the real part and ‘bi’ is the
imaginary part.
Since floats are real numbers only, they will
always return 0 when using .imag().
.
Lists
Purpose:
This function adds a single item to the end of
the list. Accordingly the length of the string
increases by 1.
.append()
Use Cases
.copy()
Purpose:
A list can be copied by using the ‘=‘
operator. But the problem with this is,
whenever we change the old list the new list
will also change.
To remedy this we can use the fuction
.copy() to just clone the old list. We can save
this cloned list as a new list and work on it.
Lists
Purpose:
This function is different from .append() as
by use of this function we can add more
than one element to our list.
Basically we can add an iterable objects.
.extend()
Use Cases
.index()
Purpose:
This function finds the given element in the
list and returns its position.
Note: If the same element is present more
than once, this function returns the index of
the first occurrence of the element.
Note: Index in python starts from 0, not 1.
We need to provide the element of which we
want to find the index.
Lists
Purpose:
This function can used to sort list of integers,
floats, strings and others.
The sorting is done in ascending,
descending or user defined order.
.sort()
Use Cases
.pop()
Purpose:
This function removes the item at the given
index from the list and returns the removed
item.
By default if we do not specify the item, then
the function will remove the last items on list.
It does not work when the index is out of
bounds or out of range.

More Related Content

PDF
Python functions
PDF
Python Unit 3 - Control Flow and Functions
PPTX
Chapter 05 classes and objects
PPT
List Data Structure
PDF
Strings in python
PPSX
python Function
PDF
Python If Else | If Else Statement In Python | Edureka
Python functions
Python Unit 3 - Control Flow and Functions
Chapter 05 classes and objects
List Data Structure
Strings in python
python Function
Python If Else | If Else Statement In Python | Edureka

What's hot (20)

PDF
JavaScript - Chapter 12 - Document Object Model
PPTX
Python Functions
PPTX
Functions in python slide share
PPTX
EXCEPTION HANDLING IN PYTHON For students .py.pptx
PPTX
Chapter 06 constructors and destructors
PPTX
Functions in python
PPTX
Command line arguments
PPTX
Python for loop
PDF
Python basic
PPTX
Linked list
PPTX
Programming
PPTX
Call by value or call by reference in C++
PDF
Python Flow Control
PPTX
Kotlin for Android App Development Presentation
PDF
Python collections
PPTX
Chapter 15 Lists
PDF
Datatypes in python
PPTX
Looping statement in python
PDF
Python strings
PDF
Assembly Language for x86 Processors 7th Edition Chapter 1: Basic Concepts
JavaScript - Chapter 12 - Document Object Model
Python Functions
Functions in python slide share
EXCEPTION HANDLING IN PYTHON For students .py.pptx
Chapter 06 constructors and destructors
Functions in python
Command line arguments
Python for loop
Python basic
Linked list
Programming
Call by value or call by reference in C++
Python Flow Control
Kotlin for Android App Development Presentation
Python collections
Chapter 15 Lists
Datatypes in python
Looping statement in python
Python strings
Assembly Language for x86 Processors 7th Edition Chapter 1: Basic Concepts
Ad

Similar to Python Built-in Functions and Use cases (20)

PPT
Python programming unit 2 -Slides-3.ppt
PPTX
Using-Python-Libraries.9485146.powerpoint.pptx
PDF
Python Objects
PPTX
Python Modules and Libraries
PPTX
Python 101++: Let's Get Down to Business!
PDF
Python lecture 03
PDF
Python Modules, Packages and Libraries
PPTX
Python Datatypes by SujithKumar
PPTX
Introduction_to_Python_operators_datatypes.pptx
PDF
Python for Scientific Computing
PDF
Processing data with Python, using standard library modules you (probably) ne...
PPTX
Basics of Python
PPTX
Python-CH01L04-Presentation.pptx
PDF
Python bootcamp - C4Dlab, University of Nairobi
PPT
From Operators to Arrays – Power Up Your Python Skills for Real-World Coding!
PPTX
Revision-of-thehki-basics-of-python.pptx
PPTX
PPTX
Review old Pygame made using python programming.pptx
PPT
Python study material
Python programming unit 2 -Slides-3.ppt
Using-Python-Libraries.9485146.powerpoint.pptx
Python Objects
Python Modules and Libraries
Python 101++: Let's Get Down to Business!
Python lecture 03
Python Modules, Packages and Libraries
Python Datatypes by SujithKumar
Introduction_to_Python_operators_datatypes.pptx
Python for Scientific Computing
Processing data with Python, using standard library modules you (probably) ne...
Basics of Python
Python-CH01L04-Presentation.pptx
Python bootcamp - C4Dlab, University of Nairobi
From Operators to Arrays – Power Up Your Python Skills for Real-World Coding!
Revision-of-thehki-basics-of-python.pptx
Review old Pygame made using python programming.pptx
Python study material
Ad

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Understanding Forklifts - TECH EHS Solution
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
System and Network Administraation Chapter 3
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
AI in Product Development-omnex systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Transform Your Business with a Software ERP System
PPTX
CHAPTER 2 - PM Management and IT Context
PTS Company Brochure 2025 (1).pdf.......
Understanding Forklifts - TECH EHS Solution
wealthsignaloriginal-com-DS-text-... (1).pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Upgrade and Innovation Strategies for SAP ERP Customers
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Navsoft: AI-Powered Business Solutions & Custom Software Development
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
System and Network Administraation Chapter 3
Essential Infomation Tech presentation.pptx
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
AI in Product Development-omnex systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
L1 - Introduction to python Backend.pptx
Transform Your Business with a Software ERP System
CHAPTER 2 - PM Management and IT Context

Python Built-in Functions and Use cases

  • 1. Python Built-in Functions and Use cases Srajan Mor
  • 2. Integers Purpose: Digital computer can only process data that has been expressed in binary format. That is to say 0 or 1, which can be expressed electronically as On/Off. For Information technology applications, the amount of information being processed is an important design consideration. The term bit-length is a technical shorthand for this measure. bit_length() method in python tell us the Number of bits necessary to represent an integer in binary number. .bit_length() Use Cases
  • 3. Integers Purpose: Not only real numbers, Python can also handle complex numbers and its associated functions. Complex numbers have their uses in many applications related to mathematics and python provides useful tools to handle and manipulate them. Complex numbers are expressed as combination of real and imaginary part. Complex number = a + bi Where ‘a’ is the real part and ‘bi’ is the imaginary part. Since integers are real numbers only, they will always return 0 when using .imag(). .real() and .imag() Use Cases
  • 4. Integers Purpose: Whenever we are dealing with complex numbers we can use this function. This function basically removes the parenthesis from an integer. .conjugate() Use Cases .numerator() .denominator() Purpose: These function return the numerator and denominator from an integer. Since integers are without any decimals, so the denominator will always be 1.
  • 5. Strings Purpose: At some point, we may need to beak a large string into smaller chunks or strings. This is opposite of concatenation which merges or combines string into one. To do this, we use the split function. It breaks the given string by the specified separator and then returns the output in form of a list. We need to specify a delimiter as the separator. If we do not define a delimiter, then python will split the string assuming whitespace as a separator. We can also define how many times we need python to split the string. By default there is no limit. .split() Use Cases
  • 6. Strings Purpose: This function returns the capitalized version of a string. We need to note that it only capitalizes the first letter of the string. .capitalize() Use Cases .lower() and .upper() Purpose: .lower() function returns the entire string in a lower case. .upper() function returns the entire string in upper case.
  • 7. Strings Purpose: This method formats the specified value and inserts them inside the string’s placeholder. A placeholder is defined using curly brackets: {}. Placeholder tell the format method the location where we need to insert a specific value. We can have multiple placeholder in a string in which we can have multiple values. This method is particularly useful when we need to pass something inside a string which is changing or is calculated. .format() Use Cases
  • 8. Float Purpose: This function returns a pair of integer whose ratio is exactly equal to the original float and with a positive denominator. Note that is returns the result in tuple. .as_integer_ratio() Use Cases .hex() and .fromhex() Purpose: .hex() function returns the hexadecimal representation of a floating point number. .fromhex() creates a floating point number from a hexadecimal string.
  • 9. Float Purpose: This function checks whether the value stored is an integer of not. Returns true if it is. .is_integer() Use Cases .imag() and .real() Purpose: Complex numbers are expressed as combination of real and imaginary part. Complex number = a + bi Where ‘a’ is the real part and ‘bi’ is the imaginary part. Since floats are real numbers only, they will always return 0 when using .imag(). .
  • 10. Lists Purpose: This function adds a single item to the end of the list. Accordingly the length of the string increases by 1. .append() Use Cases .copy() Purpose: A list can be copied by using the ‘=‘ operator. But the problem with this is, whenever we change the old list the new list will also change. To remedy this we can use the fuction .copy() to just clone the old list. We can save this cloned list as a new list and work on it.
  • 11. Lists Purpose: This function is different from .append() as by use of this function we can add more than one element to our list. Basically we can add an iterable objects. .extend() Use Cases .index() Purpose: This function finds the given element in the list and returns its position. Note: If the same element is present more than once, this function returns the index of the first occurrence of the element. Note: Index in python starts from 0, not 1. We need to provide the element of which we want to find the index.
  • 12. Lists Purpose: This function can used to sort list of integers, floats, strings and others. The sorting is done in ascending, descending or user defined order. .sort() Use Cases .pop() Purpose: This function removes the item at the given index from the list and returns the removed item. By default if we do not specify the item, then the function will remove the last items on list. It does not work when the index is out of bounds or out of range.