PY-03-P1 Loops Flashcards

1
Q

What are Loops?

A

Loops are blocks of code that run as long as the condition is true

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

A __ loop provides iterating capabilities

A

for loop

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

A ___ range, defined by r___( ) is also capable of iteration

A

set range, range( )

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

The ___ function returns the number of items of an object

A

len( )

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

The r___( ) function accepts an integer and returns the range of the object

A

range( )

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

If a condition is false, the ___ loop will not be executed

A

while loops

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

The ____ command exits a loop

A

break

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

Behaves as if the code reached the end of the block

A

continue command

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

the _____ command skips an iteration

A

continue command

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

____ statements are used as empty executions

A

pass statements

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

A loop becomes ____ if a condition is never False

A

Infinite Loops

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

the ____ function can be used to define a list within another list

A

append( )

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

adds a value to an existing variable

A

append( )

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

N __ lists can be used to arrange data in hierarchical structiures

A

nested

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

constructs an integer number casted from a string or float

A

int( )

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

Constructs a floating number from an integer or float

17
Q

Constructs a string from a wide variety of data types

18
Q

How are conditions executed?

A

by if and else commands

19
Q

Multiple if statements can be chained together using the ____ command

20
Q

using the ____ command helps make the code more efficient

21
Q

a ___ structure is a method of organizing and storing data so it can be accessed and acted upon easily

A

data structure

22
Q

Data structures in Python include ___, _____ and lit

A

dictionary, tuple

23
Q

A versatile and dynamic data type. Can hold different types of data simultaneously. The values are numerically indexed starting at 0

24
Q

A list’s indexes are used for

A

List manipulation

25
Update/add value:
listName{ index ] = newValue
26
Delete value
del listName[ index ]
27
two additional ways to change lists are
append( ) and remove( )
28
immutable sequence of python objects and are created simply by writing values separated by commas
Tuple
29
A python ____ is a collection of items
dictionary
30
Dictionaries are identified by ____
curly brackets
31
___ is used with an item's name for deletion
del
32
Data structure can hold other data structures
Nested Data Structures
33
A python data type, identified by "" A collection of indexed characters
String
34
Multiple strings can be aggregated to a single string. Performed by using the + operator
String Concatenation
35
The slicing structure is ______________.
string[ start:end:step ]
36
separates a string and arranges it as a list
Split( )