Unit 3 Flashcards
What are the 7 essential programming elements?
- Variables and tables
- Computation
- Input/Output
- Selection
- Repetition
- Data Aggregation
- Code aggregation
Elements of data aggregates first property is whether or not each element is exactly the same type as the others is called what?
Homogeneous
Elements of data aggregates first property is whether or not each element can be different types as the others is called what?
Heterogeneous
When addressing elements integer addressing is called what?
by number
When addressing elements, you address any string by what?
by name
What do you call aggregates whose size cannot be changed after being defined?
Fixed
What do you call aggregates whose size can be changed after being defined?
Dynamic
What character must be put at the end of every control construct in python?
:
In python what character is used in tuples?
parenthesis ()
In python what character is used in lists?
Square Brackets []
In python what character is used in dictionaries?
Curly Brackets {}
Why is Hello World often used in coding?
It is the smallest legal program that produces output.
In python What function can take any number of arguments but can only have one expression.
Lambda
What is the syntax for the lambda function?
lambda arguments : expression
*ex : x = lambda a : a +10
print (x(5))
What is included in conditional statements?
1: Initialization
2: Test
3: Update
What are functions that operate on other functions, either by taking them as arguments or by returning them?
Higher Order Functions
What combines all of the values in a list into a single value?
The Reduce Function
What takes elements of a list that meet a criteria and then creates a new list with those elements?
The Filter Function
What preforms transformations on each element of a list, creating a new list with the transformed elements?
The Map Function
What is the syntax for the map() function?
map(function, *iterables)
*ex: def multiply_by_2(item):
return item * item
What is the syntax for the filter() function?
filter(function, *iterables)
*ex: def only_odd(item):
return item % 2 != 0
What is the syntax for the reduce() function?
reduce(function, iterable[, initial])
*ex: def accumulator(initial, item ):
return initial + item