Chat with us, powered by LiveChat Start the Python interpreter and use it as a calculator - Credence Writers
+1(978)310-4246 credencewriters@gmail.com
Select Page

Please complete exercises 1.4, 2.2 and 2.3 (parts 2 and 3). For parts 1.4 and 2.3, you will write python scripts in an editor like notepad and save them as python files as we did in class. Remember, you can install python at home on your computer.  Complete all questions and submit a zip file. If you don’t know how to do this, research it. It is very simple… put all files in a folder, compress the folder and upload it as your submission. It is 3 clicks on a mouse. Your programs need to work, no errors.

Exercise 1.4: Start the Python interpreter and use it as a calculator. Python’s syntax for math operations is almost the same as standard mathematical notation. For example, the symbols +, – and / denote addition, subtraction and division, as you would expect. The symbol for multiplication is *. If you run a 10 kilometer race in 43 minutes 30 seconds, what is your average time per mile? What is your average speed in miles per hour? (Hint: there are 1.61 kilometers in a mile).

Exercise 2.2: Assume that we execute the following assignment statements: width = 17 height = 12.0 delimiter = ‘.’ For each of the following expressions, write the value of the expression and the type (of the value of the expression). 1. width/2 2. width/2.0 3. height/3 4. 1 + 2 * 5 5. delimiter * 5

Exercise 2.3: Practice using the Python interpreter as a calculator: 1. The volume of a sphere with radius r is 4 3 πr 3 . What is the volume of a sphere with radius 5? Hint: 392.7 is wrong! 2. 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? 3. 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?

error: Content is protected !!