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

Python Methods

Uploaded by

Jeevan Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Python Methods

Uploaded by

Jeevan Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Sr.

Method Name Description Syntax


No.
Example
1 print() This function is used to display specified content on the screen.
2 quit() or exit() This function is used to close the python shell.
3 id() This function is used to check the address of an object/variable.
4 type() This function is used to determine the type of a variable i.e. what type
of value does it hold.
5 input() This function is used to get data from the user while working with the
script mode. It will take data as string.
6 int() This function converts the inputted string value into numeric value.
7 eval() This function is used to evaluate the value of a string. It takes a string as
an argument, evaluates the string as a number, and returns the numeric
result.

8 range() This function is used to create a list containing a sequence of numbers


starting with start and ending with one less than stop.
9 len() This method returns the length of the string. len(string)
10 capitalize() This methos returns the exact copy of the string with the first letter in
upper case.
str.capitalize()
11 splilt() This method breaks up a string at the specified separator and returns a
list of substrings.
str.split(
12 float() This function converts the inputted string value into floating point value
i.e. numeric with decimal value.
13 complex() This function converts the inputted string value into complex value.

14 string() This function converts the inputted Numeric / boolean value into string
value.
15 ceil() This function returns the smallest integer not less than number
16 sqrt() This function returns the square root of number. If number is less than
zero then an error occurs.
17 exp() It returns the natural logarithm e raised to the arg power.
18 fabs() It returns the absolute value of the number.
19 log()

You might also like