\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Recitation 2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We have written a program that checks if a positive integer (or range of integers) satisfies the Collatz conjecture (using \"while\" and \"for\" loops). We have also covered the basics of lists and list functions and solved an exercise (demonstrating list comprehension). Finally, we have discussed functions, short circuit evaluation and analyzed the efficiency of the functions we saw.\n",
"\n",
"#### Takeaways:\n",
"\n",
"\n",
"
Sometimes its beneficial to implement even abstract problems in order to see the \"big picture\" (in the context of Collatz).
\n",
"
Lists can be a highly modular and useful data structure. Make sure that you understand their functionality and also their limits (figuratively and literally).
\n",
"
Functions can be used in one another (max2 in max3_v3) and can be composed together.
\n",
"
When analyzing a function's performance, think about the input that will cause the largest amount of work and then measure how many operations the function does.
\n",
"
Using short circuit evaluation, if e.g. you have a long \"and\" condition, place the part that is most easy to compute first since if it is false, all other parts of the condition will not be computed.