Week 7 Flashcards
What is a first-class object?
An object that can be treated as a variable (assigned to variables, passed as arguments, returned from other functions)
What does the reduce() function do?
It applies a function of two arguments cumulatively to the items of a sequence, reducing it to a single output
What are higher order functions?
Functions that take other functions as arguments or return functions.
What is recursion?
When a function calls itself
What is declarative programming?
Programming that focuses on what the program should do
What is declarative programming?
Programming that focuses on what the program should do
What is imperative programming?
How
What are some benefits of functional programming?
Break complex problems into smaller steps
What are some benefits of functional programming?
Break complex problems into smaller steps
How is a conditional expression typically written?
<Consequent> if <predicate> else <alternative>
</alternative></predicate></Consequent>
Are number mutable or immutable in Python?
Immutable
What does DRY mean in programming?
Don’t Repeat Yourself
What does .pop() do in Python?
It returns and removes the last element (or the element at the index included in parentheses?)
What does .pop() do in Python?
It returns and removes the last element (or the element at the index included in parentheses?)