Skip to main content

Important Python Functions

Some Important Python Functions

The following are some of the useful built-in Python functions.

len()

The function len() returns the length of a string, list, set or array.
say
x=['new', 'tomato', 'ketchup']
len(x)
returns 3.

print()

print('Hellow')
Observe the response.

input()

input() receives a value from the Python console.
x=input()
Now input a string from the keyboard to the console. The string will be stored in the variable x. print(x) will print the string.

float(),int(), str() and complex()

float(5) returns 5.0, int(5.3) returns 5, str(5.3) returns the string '5.3' and complex(5,3) returns 5+j3.

Comments