Answer these in Python
pi
from the math
module.for
loop:
operator in a string.}Answers these symbolically
z
is greater than 10.z
less than -25 but greater than -35.%
operator in python, which computes the remainder of the left number after being divided by the right number, to compute the remainder of 12 divided by 5.%
operator in a boolean expression to print 'even' if the variable z
is even.z
is positive or negative, even or odd, and greater in magnitude than 10.Answers these questions in Python. Print your result
range
function.=
), override the last element to be 100. for
loop print out $2^i$, where $i$ is the elements in your list.Answers these questions in Python
When specifying an interval, parenthesis indicate an exclusive end-point and brackets indicate an inclusive end-point. So $\left(0,1\right)$ means from 0 to 1, not including 0 or 1. $\left[0, 1\right)$ means from 0 to 1 including 0 but not including 1.
arange
function.linspace
function.arange
function.linspace
function.Answer these in questions in Python. Label your axes as x-axis
and y-axis
.
[4 points] Make a plot of the cosine from $-pi$ to $0$.
[4 points] We will see that the equation $e^{-x^2}$ is important in a few weeks. Make a plot of it from -2, to 2.
[8 pints] Plot $x$, $x^2$, and $x^3$ from -1 to 1. Label your lines with a legend, add a title, use the seaborn-darkgrid
style, and set the figure size as $4\times3$.