Opening the book…
Exercise \(\PageIndex{1}\)
Repeating my advice from the previous chapter, whenever you learn a new feature, you should try it out in interactive mode and make errors on purpose to see what goes wrong.
- We’ve seen that
n = 42is legal. What about42 = n? - How about
x = y = 1? - In some languages every statement ends with a semi-colon,
;. What happens if you put a semi-colon at the end of a Python statement? - What if you put a period at the end of a statement?
- In math notation you can multiply
xandylike this:x y. What happens if you try that in Python?
Exercise \(\PageIndex{2}\)
Practice using the Python interpreter as a calculator:
- The volume of a sphere with radius \(r\) is \( 4/3 \pi r^3 \). What is the volume of a sphere with radius 5?
- Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping costs $3 for the first copy and 75 cents for each additional copy. What is the total wholesale cost for 60 copies?
- If I leave my house at 6:52 am and run 1 mile at an easy pace (8:15 per mile), then 3 miles at tempo (7:12 per mile) and 1 mile at easy pace again, what time do I get home for breakfast?
This page titled 2.10: Exercises was last modified on Tue, 01 Dec 2020 03:30:51 GMT and is shared under a CC BY-NC 3.0 license and was authored, remixed, and/or curated by Allen B. Downey (Green Tea Press) via source content that was edited to the style and standards of the LibreTexts platform.
The book could not be loaded just now.