September 2013
Intermediate to advanced
350 pages
9h 38m
English
Here are some exercises for you to try on your own. Solutions are available at http://pragprog.com/titles/gwpy2/practical-programming.
For each of the following expressions, what value will the expression give? Verify your answers by typing the expressions into Python.
Unary minus negates a number. Unary plus exists as well; for example, Python understands +5. If x has the value -17, what do you think +x should do? Should it leave the sign of the number alone? Should it act like absolute value, removing any negation? Use the Python shell to find out its behavior.
Write two assignment statements that do the following. ...
Read now
Unlock full access