Python - Coding Terms/Commands Flashcards

1
Q

Return the absolute value of a number. The argument may be an integer or a floating point number. If the argument is a complex number, its magnitude is returned.

A

abs(x)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Return True if all elements of the iterable are true (or if the iterable is empty).

A

all(iterable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Return True if any element of the iterable is true. If the iterable is empty, return False.

A

any(iterable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

allows to loop over something and have an automatic counter.

A

enumerate(iterable, start=0)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

allows user to input.

A

.input([prompt])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

a string method and returns a string in which the elements of sequence have been joined by str separator.

A

.join() function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Return the lowest valued number.

A

min()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Return the highest valued number.

A

max()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

return a random integer n such that a<= n <= b.

A

random.randint(a,b)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

generates a sequences of numbers in the form of a list.

A

.range()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

break a large string down into smaller strings.

A

.split()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

method inserts the specified value at the specified position.

A

.insert()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

returns a list of dict’s (key, value) tuple pairs

A

.items()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

method appends an element to the end of the list

A

.append()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

an inbuilt function in Python that removes and returns last value from the list or the given index value

A

.pop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

return an integer object from any number or string

A

int

17
Q

returns data as a string

A

str

18
Q

an inbuilt function that returns a copy of the string where all occurrences of a substring is replaced with another substring.

A

.replace()

19
Q

returns the length of a specific string

A

len

20
Q

returns a copy of the string in which all case-based characters have been uppercased.

A

.upper()

21
Q

returns a copy of the string in which all case-based characters have been lowercased.

A

.lower()

22
Q

converts the first character of a string to capital (uppercase) letter

A

.capitalize()

23
Q

returns an iterator that accesses the given sequence in the reverse order.

A

reversed

24
Q

applies a function to all the items in an input_list.

A

map

25
Q

creates a list of elements for which a function returns true.

A

filter

26
Q

function for performing some computation on a list and returning the result. It applies a rolling computation to sequential pairs of values in a list.

A

reduce

27
Q

function is used for creating small, one-time and anonymous function objects.

A

lambda

28
Q

Local, Enclosing, Global, Built-in(Python)

A

LEGB

29
Q

method of the string class allows you to do variable substitutions and value formatting. This lets you concatenate elements together within a string through positional formatting.

A

.format()