Built-ins Menu

Functions

Item

Description

def function():

Defines a function dependent on specified variables.

return

Defines the value produced by a function.

 

Control

Item

Description

if..

Conditional statement.

if..else..

Conditional statement.

if..elif..else..

Conditional statement.

for index in range(size):

Iterates over a range.

for index in range(start,stop):

Iterates over a range.

for index in range(start,stop,step):

Iterates over a range.

for index in list:

Iterates over list elements.

while..

Executes statements in a code block until a condition evaluates to False.

elif:

Conditional statement.

else:

Conditional statement.

 

Ops

Item

Description

x=y

Sets variable value.

x==y

Pastes equal to (==) comparison operator.

x!=y

Pastes not equal to (!=) comparison operator.

x>y

Pastes greater than (>) comparison operator.

x>=y

Pastes greater than or equal to (>=) comparison operator.

x<y

Pastes less than (<) comparison operator.

x<=y

Pastes less than or equal to (<=) comparison operator.

and

Pastes and (and) logical operator.

or

Pastes or (or) logical operator.

not

Pastes not (not) logical operator.

True

Pastes True Boolean value.

False

Pastes False Boolean value.

 

Lists

Item

Description

[]

Pastes brackets ([]).

list()

Converts sequence into "list" type.

len()

Returns number of elements of the list.

max()

Returns maximum value in the list.

min()

Returns minimum value in the list.

.append()

The method appends an element to a list.

.remove()

The method removes the first instance of an element from a list.

range(start,stop,step)

Returns a set of numbers.

for index in range(start,stop,step)

Used to iterate over a range.

.insert()

The method adds an element at the specified position.

.split()

The method returns a list with elements separated by specified delimiter.

sum()

Returns sum of the elements of a list.

sorted()

Returns a sorted list.

.sort()

The method sorts a list in place.

 

Type

Item

Description

int()

Returns an integer part.

float()

Returns a float value.

round(x,ndigits)

Returns a floating point number rounded to the specified number of digits.

str()

Returns a string.

complex()

Returns a complex number.

type()

Returns the type of the object.

 

I/O

Item

Description

print()

Displays argument as string.

input()

Prompts user for input.

eval()

Evaluates an expression represented as a string.

.format()

The method formats the specified string.