Topic 4 - Session 4 - MTA Intro Course Flashcards

1
Q

Define what a function does in Python?

A

A function is code which can be reused.

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

What types of statements require indentation?

A

If, while and for loops require indentation.

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

What is pydoc?

A

It is a documentation generator module.

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

What command would you enter to find additional information on the “pass” command using pydoc

A

python -m pydoc pass

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

Is python picky as to where function are written in programs?

A

Yes - functions have to be written before they are called.

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

What does “def” mean in relation to functions in python?

A

It means that you wish to define a function in python.

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

What is missing from the following function definition?

def fullName(firstName, lastName)

A

It is missing a colon at the end of the line. It should be…

def fullName(firstName, lastName):

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

What purpose does the pass keyword serve?

A

The pass keyword serves as a mere placeholder for potential future code.

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