This is the standard naming convention for Python variables (e.g., user_name).
Snake Case
This operator returns the remainder of a division.
This method replaces a specified phrase with another specified phrase.
.replace()
You use this keyword to start the definition of a function.
def
The specific values you pass into a function when calling it.
Arguments
This function is used to find out the data type of a variable.
type()
The operator ** is used to calculate this.
Exponentiation (will accept power or exponents)
This method converts the entire string to uppercase.
.upper()
These must follow the function name and contain any parameters.
Parentheses ()
The keyword used to send a value back to the caller.
return
This is the result of type(5 / 2). (Hint: Pay attention to the sign)
float
In 10 // 3, this is the resulting value.
3 (floor division)
This method removes whitespace from the start and end of a string.
.strip()
This refers to the indented block of code that belongs to a function.
Function body
A function that does not have a return statement technically returns this.
Changing a variable from one type to another (like str(10)) is called this.
Type Casting
The result of 10 + 2 * 3 based on Python's order of operations.
16
This method checks if a string starts with a specific character or prefix.
.startswith()
To execute a function, you must do this to it by using its name and parentheses.
Call or Invoke the function
These are the variable names listed in the function definition.
This "collection" type is an ordered, changeable sequence of elements.
List
This function returns the absolute value of a number.
abs()
This method returns the index of the first occurrence of a specified value.
.find() or .index()
This "placeholder" keyword allows you to define an empty function without an error.
pass
What is the value of output in the following program?
def calculate_power_plus(base, exponent, bonus=5):
result = (base ** exponent) + bonus
return result
# Calling the function
output = calculate_power_plus(3, 2, 10)
19