4.6 Flashcards

1
Q

“For” loop statement.

A

iterates over a list of items or a group of steps for each item in a list.

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

“For” Loop code for range.

A

for n in range (10):

print(n)

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

“For” loop for sequence(fruits).

A

fruits=(“Apples”,”Oranges”,”Banana”)
for n in fruits:
print(n)

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

“While” loop statement

A

repeats a step or group of steps while a given condition is true

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

“while” loop code

A
n = 10
while n > 0:
  print(n)
  n = n - 1
  print ("i like python.")
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

python built-in function that returns absolute value of a number.

A

abs()

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

python built-in function that returns string containing printable representation.

A

ascii()

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

python built-in function that converts integer to binary string

A

bin()

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

python built-in function that returns a character (a string) from an integer.

A

chr()

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

python built-in function that returns the number of items in an object or the number of characters in a string.

A

len()

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

python built-in function returns x to the power of y

A

pow()

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

python built-in function that prints the given object

A

print()

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

python built-in function that returns sequence of integers between start and stop

A

range()

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

python built-in function that rounds a floating point number to n places

A

round()

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

python built-in function that adds items of an iterable

A

sum()

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

Function (in python).

A

is a block of code that only runs when it is called.

17
Q

it is a block of organized and reusable code that is used to perform a single task.

A

Function (in python)

18
Q

_________ that you can use to save time and shorten your code.

A

python built-in functions

19
Q

functions that you create by yourself.

A

user-defined functions

20
Q

We use _________ so that it actually performs the specified actions in the Function.

A

Function call (calling the function)