What kind of variable stores text?
String
Function definition begins with what keyword?
def
What new data type was introduced in class today?
Boolean
What kind of error is caused by a "grammar" error in the code?
Syntax Error
print("num = " + str(15 + 5))
num = 20
What variable type stores whole numbers?
Integer
A function that does not return a value is known as a ___ function
void
Explain the difference between assignment operator and equivalence operator.
assignment: =
equivalence: ==
You are writing a basic calculator program. When the user tries to divide by 0, the program crashes. The crash is an example of a _____ error.
Runtime
var_x = "400"
var_y = 100.0
print(int(var_x) + var_y)
500
True / False you can not change a string variable to a float variable.
False
True / False
Functions in python can return multiple values.
False
What is the not equal to opperatior?
!=
You wrote a program to convert monetary values from one currency to another, the program executes without error but the output is not correct. What kind of error would cause this behavior?
Logic Error
print("num = + str(15 + 5)")
num = + str(15 + 5)
Your program combines the values of one or more strings into one continuous string. What string operation is your program preforming?
Concatenation
True / False
It is possible to call a function within within the definition of a second separate function.
True
Explain the not opperator.
The not operator flips the value of a boolean.
What kind of error will not directly impact end users of a program?
Syntax Errors
def say_hello();
print("Hello!")
say_hello()
Error
You are writing a function in python that returns a string value. This string value must contain the value of a float type variable, explain how this is possible.
When a function is defined, the values passed into the parentheses are known as parameters, what are those values called when passed into a function call?
Arguments
When an if / else structure is being evaluated, the boolean structure following if must be ___ for the code within the if block to be executed.
True
What is one way that you would prevent runtime errors?
Any acceptable answer
def remove_charachter(input_string, charachter):
output_string = ""
for char in input_string:
if char != charachter:
output_string += char
return output_string
Nothing function is never called