[pythonvis] exercise discussion

  • From: Ivan Pivac <Ivan@xxxxxxxxxxxxx>
  • To: pythonvis@xxxxxxxxxxxxx
  • Date: Sun, 18 May 2014 22:03:11 +1200

Hi everyone,

Since Thursday's learning room meeting, I have been working my way through the two exercises at the end of chapter 2 in the book, Think Like a Computer Scientist. I wonder if if would be a a good idea to go through these two exercises, looking at the code and how best to produce the final output?

In the first task looking at the cost of retailing books, I resolved the problem, but, I wonder if my code could be more efficiently written. One question in this exercise is how to write the code where the retail cost of the book is $24.95 but the dealer receives a 40% discount. My solution was:
24.95/10*6
however, the code didn't seem correct to me although the answer was after doing the maths on a calculator. .

In exercise two regarding what time a walker returned home, I have the total time taken to walk the distance but don't know how to add those minutes onto the time of 6.52 am.

Would it be worth while, I wonder, if the experts on the list could actually code the exercises as we work through them so that we can discuss the tasks on the learning room forum? there may be several ways of producing the answer so examining those methods would also be an invaluable learning experience. Meanwhile, I'll continue working on the home arrival time.



Regards
Ivan

--
Ivan Pivac
4271 Great North Rd
P O Box 69-203
Glendene
Auckland 0645
New Zealand
Tel: (64) 9 836-8876
Fax: (64) 9 836-4668
Email: ivan@xxxxxxxxxxxxx



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


Other related posts: