Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
0 views

Built_in_Functions_and_Modules_in_Python

The document outlines built-in functions and modules in Python, which are always available without importing any modules. It categorizes functions into type conversion, math-related, data handling, I/O, and others, and lists important built-in modules such as math, random, and datetime. Examples demonstrate the usage of both built-in functions and modules.

Uploaded by

Ranveer Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Built_in_Functions_and_Modules_in_Python

The document outlines built-in functions and modules in Python, which are always available without importing any modules. It categorizes functions into type conversion, math-related, data handling, I/O, and others, and lists important built-in modules such as math, random, and datetime. Examples demonstrate the usage of both built-in functions and modules.

Uploaded by

Ranveer Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Built-in Functions and Modules in Python

1. Built-in Functions in Python

1. Built-in Functions in Python

These are functions that are always available in Python without needing to import any module.

Common Categories:

Type Conversion: int(), float(), str(), bool(), list(), tuple(), dict()

Math-related: abs(), round(), max(), min(), sum(), pow()

Data Handling: len(), sorted(), reversed(), enumerate(), zip()

I/O: print(), input()

Others: type(), id(), isinstance(), range(), any(), all(), eval(), exec()

Example:

numbers = [1, 2, 3]

print(sum(numbers)) # Output: 6

2. Built-in Modules in Python

2. Built-in Modules in Python

Modules are files containing Python code (functions, classes, variables) which you can import and use.

Important Built-in Modules:


Built-in Functions and Modules in Python

math - Mathematical operations

random - Random number generation

datetime - Date and time manipulation

os - Interacting with the operating system

sys - System-specific parameters and functions

json - Working with JSON data

re - Regular expressions

time - Time-related functions

Example:

import math

print(math.sqrt(16)) # Output: 4.0

You might also like