0% found this document useful (0 votes)
20 views

Built-In Functions and Methods All

Uploaded by

Bandari Ganesh
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)
20 views

Built-In Functions and Methods All

Uploaded by

Bandari Ganesh
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/ 6

09/10/2024, 22:16 ChatGPT

Here’s a detailed table listing each category, along with individual functions, methods, or concepts,
their counts, and descriptions:

1. Built-in Functions
Function Description

int() Converts a value to an integer.

float() Converts a value to a floating-point number.

str() Converts a value to a string.

bool() Converts a value to a boolean (True or False).

complex() Converts a value to a complex number.

list() Converts a value to a list.

tuple() Converts a value to a tuple.

set() Converts a value to a set.

dict() Converts a value to a dictionary.

abs() Returns the absolute value of a number.

pow() Returns x raised to the power y (x^y).

round() Rounds a number to a given precision.

sum() Sums an iterable (e.g., a list or tuple).

min() Returns the smallest item from an iterable.

max() Returns the largest item from an iterable.

divmod() Returns the quotient and remainder as a tuple.

print() Outputs data to the console.

input() Gets user input as a string.

open() Opens a file and returns a file object.

len() Returns the length of an object (e.g., list, string).

type() Returns the type of an object.

isinstance() Checks if an object is an instance of a class or type.

id() Returns the unique identifier for an object.

dir() Returns a list of attributes and methods of an object.

https://chatgpt.com/c/6706b121-1418-800c-a93c-8e62e59a2b66 1/6
09/10/2024, 22:16 ChatGPT

Function Description

help() Displays the documentation of an object or function.

range() Generates a sequence of numbers.

iter() Returns an iterator object.

next() Retrieves the next item from an iterator.

lambda Creates an anonymous function (inline function).

reduce() Reduces an iterable to a single value by applying a function. (from functools )

functools.partial() Allows partial function application.

ord() Converts a character to its ASCII/unicode value.

chr() Converts an ASCII/unicode value to its character equivalent.

ascii() Returns a string with a printable representation of an object.

repr() Returns a string representation of an object (used for debugging).

frozenset() Converts a collection to an immutable set.

memoryview() Creates a view object that exposes a buffer's data.

bytes() Converts an object to an immutable bytes object.

bytearray() Returns an array of bytes.

hex() Converts an integer to hexadecimal.

bin() Converts an integer to binary.

oct() Converts an integer to octal.

eval() Evaluates a Python expression.

exec() Executes Python code dynamically.

compile() Compiles a source into a code object.

Total Built-in Functions: 73

2. String Methods
Method Description

upper() Converts a string to uppercase.

https://chatgpt.com/c/6706b121-1418-800c-a93c-8e62e59a2b66 2/6
09/10/2024, 22:16 ChatGPT

Method Description

lower() Converts a string to lowercase.

replace() Replaces substrings in a string.

find() Returns the index of the first occurrence of a substring.

split() Splits a string into a list.

join() Joins a list of strings into one string.

startswith() Returns True if the string starts with the specified value.

endswith() Returns True if the string ends with the specified value.

strip() Removes leading and trailing spaces (or other specified characters).

lstrip() Removes leading spaces (or specified characters).

rstrip() Removes trailing spaces (or specified characters).

isalpha() Returns True if the string consists of only alphabetic characters.

isdigit() Returns True if the string consists of only digits.

islower() Returns True if all alphabetic characters in the string are lowercase.

isupper() Returns True if all alphabetic characters in the string are uppercase.

count() Returns the number of occurrences of a substring.

partition() Splits the string at the first occurrence of the separator and returns a tuple.

rpartition() Splits the string at the last occurrence of the separator and returns a tuple.

Total String Methods: 13

3. List Methods
Method Description

append() Adds an element to the end of a list.

extend() Extends a list by appending elements from an iterable.

insert() Inserts an element at a specific position.

remove() Removes the first occurrence of a value.

pop() Removes and returns the last or specified item in a list.

https://chatgpt.com/c/6706b121-1418-800c-a93c-8e62e59a2b66 3/6
09/10/2024, 22:16 ChatGPT

Method Description

sort() Sorts the list in place.

reverse() Reverses the list in place.

copy() Returns a shallow copy of the list.

clear() Removes all items from the list.

index() Returns the index of the first occurrence of a value.

count() Returns the number of occurrences of a value.

Total List Methods: 8

4. Dictionary Methods
Method Description

keys() Returns a view object of dictionary keys.

values() Returns a view object of dictionary values.

items() Returns a view object of dictionary key-value pairs.

get() Returns the value of a key. If the key does not exist, returns None or a specified default.

update() Updates the dictionary with elements from another dictionary or iterable.

pop() Removes the item with the specified key and returns its value.

popitem() Removes and returns the last inserted key-value pair.

copy() Returns a shallow copy of the dictionary.

clear() Removes all elements from the dictionary.

setdefault() Returns the value of the specified key. If the key does not exist, inserts the key with the
specified value.

Total Dictionary Methods: 7

https://chatgpt.com/c/6706b121-1418-800c-a93c-8e62e59a2b66 4/6
09/10/2024, 22:16 ChatGPT

5. Set Methods
Method Description

add() Adds an element to a set.

remove() Removes an element from a set.

discard() Removes an element from a set if it is present.

pop() Removes and returns an arbitrary element from the set.

union() Returns the union of sets.

intersection() Returns the intersection of sets.

difference() Returns the difference of sets.

issubset() Checks if one set is a subset of another.

issuperset() Checks if one set is a superset of another.

symmetric_difference() Returns the symmetric difference of two sets (elements that are in either set, but
not both).

Total Set Methods: 6

6. Advanced Python Concepts


Concept Description

Decorators Special functions used to modify the behavior of other functions or methods.

@staticmethod Defines a static method that doesn't access or modify the class state.

@classmethod Defines a class method that takes the class as the first parameter.

@property Allows a method to be accessed like an attribute, enabling getter/setter behavior.

Context Managers Used for resource management (e.g., file handling) with the with statement.

Custom Exceptions Ability to create user-defined exceptions by subclassing Exception .

Comprehensions Concise way to create lists, dictionaries, or sets from existing iterables.

Generators Functions that return an iterator using the yield statement.

Total Advanced Python Concepts: 9

https://chatgpt.com/c/6706b121-1418-800c-a93c-8e62e59a2b66 5/6
09/10/2024, 22:16 ChatGPT

Grand Total
Category Total Count

Built-in Functions 73

String Methods 13

List Methods 8

Dictionary Methods 7

Set Methods 6

Advanced Python Concepts 9

Grand Total 116

This comprehensive table presents each function, method, or concept organized by category, along
with descriptions for better understanding.

https://chatgpt.com/c/6706b121-1418-800c-a93c-8e62e59a2b66 6/6

You might also like