PCEP Module 2: Introduction to Python and Computer Programming Flashcards

the fundamentals of computer programming, i.e., how the computer works, how the program is executed, how the programming language is defined and constructed; the difference between compilation and interpretation; what Python is, how it is positioned among other programming languages, and what distinguishes the different versions of Python. (9 cards)

1
Q

What does the print() function do in Python?

A

It shows a message or output on the screen.

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

What are two things a function can do?

A

Make something happen. 2) Return a value.

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

What are the three types of functions in Python?

A

1) Built-in functions
2) Functions from modules
3) Functions you create yourself

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

True or False — A Python function can take any number of arguments, including none.

A

True

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

Besides the name, what else is important in a function?

A

The arguments — they’re the inputs the function uses.

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

What should you think about when naming a function?

A

The name should describe what the function does.

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

What do Python functions always need?

A

Parentheses () — even if there are no arguments.

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

How do you run a function with arguments?

A

Put the arguments inside the parentheses.

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

True or False — You must use parentheses even if there are no arguments.

A

True

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