5-to-10-minute suggested exercises, April 2-7, CMS.951 (1) Write some code to count down from 9, printing only odd numbers. Do this in the most direct/obvious way with code that you write first, then check the third item here to see how this can be done concisely using built-in capabilities of Python that we haven't discussed: http://docs.python.org/2/tutorial/datastructures.html#looping-techniques (2) Iterate through a list in sorted order without changing the original list. Do this in the most direct/obvious way with code that you write first, then check the fourth item here to see how this can be done concisely using built-in capabilities of Python that we haven't discussed: http://docs.python.org/2/tutorial/datastructures.html#looping-techniques (3) Explore how addition (+) and multiplication (*) work on sequences. What are three sequences we discussed in class? (Hint: one of them is a list.) Why do subtraction (-) and division (/) not work on sequences? Advanced activity: write a function that implements string subtraction (it takes two arguments, both of them strings, the second to be subtracted from the first) when it is possible and returns None otherwise. (4) Continuing the last exercise: Why does exponentiation (**) not work, as in [1,2,3]**2? If it's not obvious, first be sure you understand what exactly exponentiation does in the straightforward case of two integers (e.g., 3**2). If it is obvious, just confirm that exponentiation doesn't work on sequences and today's exercise will take only 15 seconds. (5) Write a tip calculator by defining a function (using 'def') that accepts the price of the meal as an argument and uses a standard, built-in tipping percentage (you can choose it). (6) Elaborate your tip calculator so that it also accepts a star rating ('****' best, no stars worst) for the service as an argument. Write it so that it provides a larger tip for better service, a smaller tip for worse service.