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

A

float( )

17
Q

Constructs a string from a wide variety of data types

A

str( )

18
Q

How are conditions executed?

A

by if and else commands

19
Q

Multiple if statements can be chained together using the ____ command

A

elif

20
Q

using the ____ command helps make the code more efficient

A

elif

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

A

List

24
Q

A list’s indexes are used for

A

List manipulation

25
Q

Update/add value:

A

listName{ index ] = newValue

26
Q

Delete value

A

del listName[ index ]

27
Q

two additional ways to change lists are

A

append( ) and remove( )

28
Q

immutable sequence of python objects and are created simply by writing values separated by commas

A

Tuple

29
Q

A python ____ is a collection of items

A

dictionary

30
Q

Dictionaries are identified by ____

A

curly brackets

31
Q

___ is used with an item’s name for deletion

A

del

32
Q

Data structure can hold other data structures

A

Nested Data Structures

33
Q

A python data type, identified by “” A collection of indexed characters

A

String

34
Q

Multiple strings can be aggregated to a single string. Performed by using the + operator

A

String Concatenation

35
Q

The slicing structure is ______________.

A

string[ start:end:step ]

36
Q

separates a string and arranges it as a list

A

Split( )