Python 3 Flashcards
What are arithmetic operators in Python?
/, +, *. %, -
What are comparison operators in Python?
> , =, =, !=, ==
What are the operators for Boolean values?
And, Or, Not
What are string values in Python?
text
What does “what’s” + “ up!” return?
What’s up!
What does this code produce?
“hello” + 6
TypeError
Can’t concat a string and numerical value
What’s the result of
“3” + “4”
‘34’
in string form
What is the process of transforming one data type into another?
Type casting
How would you typecast the number 6 to a string?
str(6)
The type( ) method returns what?
the type of the object being passed.
A function is what?
a sequence of instructions that performs a specific task packaged as a unit.
Select the best answer, a function is?
a. reusable
b. flexible
c. modular
d. all of the above
d. all of the above
In f(x) = x 2
What is the f?
What is the (x)?
What does x2 represent?
name of the function input function definition
How do you define a Python 3 function?
with the def keyword
When typing print(‘Hello”) what is it’s purpose
it’s calling the print function
The Hello is what in this code?
print(‘Hello”)
the parameter being passed to the print function
What is (name) in:
def hello(name): greet = 'Hello" + name print(greet)
name is the input variable
How do you define the output of a function?
with the return statement
What makes a function flexible?
the parameters
What makes a function reusable?
instead of constantly rewriting the same code you can just make a function call and pass the appropriate parameters
We use control structure to ________ control flow.
alter
What is the primary method for alternating control flow?
reading boolean values
Each loop is counted as how many interactions?
one