Python 3 Flashcards

1
Q

What are arithmetic operators in Python?

A

/, +, *. %, -

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

What are comparison operators in Python?

A

> , =, =, !=, ==

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

What are the operators for Boolean values?

A

And, Or, Not

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

What are string values in Python?

A

text

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

What does “what’s” + “ up!” return?

A

What’s up!

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

What does this code produce?

“hello” + 6

A

TypeError

Can’t concat a string and numerical value

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

What’s the result of

“3” + “4”

A

‘34’

in string form

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

What is the process of transforming one data type into another?

A

Type casting

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

How would you typecast the number 6 to a string?

A

str(6)

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

The type( ) method returns what?

A

the type of the object being passed.

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

A function is what?

A

a sequence of instructions that performs a specific task packaged as a unit.

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

Select the best answer, a function is?

a. reusable
b. flexible
c. modular
d. all of the above

A

d. all of the above

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

In f(x) = x 2
What is the f?
What is the (x)?
What does x
2 represent?

A
name of the function
input
function definition
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you define a Python 3 function?

A

with the def keyword

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

When typing print(‘Hello”) what is it’s purpose

A

it’s calling the print function

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

The Hello is what in this code?

print(‘Hello”)

A

the parameter being passed to the print function

17
Q

What is (name) in:

def hello(name):
   greet = 'Hello" + name
   print(greet)
A

name is the input variable

18
Q

How do you define the output of a function?

A

with the return statement

19
Q

What makes a function flexible?

A

the parameters

20
Q

What makes a function reusable?

A

instead of constantly rewriting the same code you can just make a function call and pass the appropriate parameters

21
Q

We use control structure to ________ control flow.

A

alter

22
Q

What is the primary method for alternating control flow?

A

reading boolean values

23
Q

Each loop is counted as how many interactions?

A

one