small medium large xlarge

05 Mar 2013, 11:05
Paul Gries (46 posts)

Congrats on finding your way here!

We’re pretty darned excited about getting the book beta out, and we’re interested in hearing your feedback.

Cheers, Jason, Jen, and Paul

04 Mar 2013, 00:50
Karin Isberg (1 post)

Just d/l it! Have been waiting for it since LTP1 ended. Thank you! Karin.

04 Mar 2013, 00:56
Mauricio Menna Barreto Foz (1 post)

Witch is the difference between “Practical Programming..using Python” version 2011-1-20 (I just bought) and “Practical Programming … Python3” second edition Beta?

05 Mar 2013, 12:45
Paul Gries (46 posts)

We’ve rewritten most of the book as a result of our experiences teaching programming over the past 5 or so years. Every chapter has had pretty massive updates – well over half of the second edition is new writing. Among other things, we use a new approach to writing functions (a modification of an approach in How to Design Programs, a textbook for the Scheme programming language), which we find helps people new to programming.

Another significant difference is that the programming language Python had significant changes made to it in the update from Python 2 to Python 3. The new book uses Python 3.

Last, we’ve fixed a bunch of small mistakes in terms of ordering of material, and our exercises are (we think) much better than they used to be.

10 Mar 2013, 13:56
Michel Lemay (1 post)

Second version. Thank you for the quality of your cours in Cousera. Excuse my english it is not my mother tong.

I want to add some explanation to get a better understanding about the relation // and % in the page 13, starting at “Be careful about using % and // with negative operands.

My suggestion: Be careful about using % and // with negative operands. It could look more natural to think about this functions like this:

__ DividendDivisorQuotientRemainder __ 17____ 10_____ 1___ 7 __-17__-10__ 1____-7 __ 17____-10____-1__ 7 __-17___ 10____-1__-7

Freepascal and Delphi work like this. But this cause a lot of bug. Example:

If you have a clock at 9.00h, what is the time 24 hours before?

The answer is: -15 % 12 With Freepascal and Delphi you will get 2.00h, and it is wrong.

To solve this kind of bug, the majority of the programming language like Python use an other interpretation of // and %:

__Dividend__DivisorQuotientRemainder ___ 17__ 10____ 1_____ 7 __-17__-10___ 1____-7 __ 17____-10____-2____-3 __-17____ 10____-2_____ 3

___ 17____ 17____ 1_____ 0 __-17__-17___ 1_____ 0 ___ 17____-17____-1_____ 0 __-17___ 17____-1_____ 0

And with Python you will get the good answer: -15 % 12 is equal to 9

What is important to remember:

–Python takes the floor of the result of an integer division, the result is one smaller in negative answer then positive answer: __»> -17 // 10 __-2

–Exception if your remainder is 0, the result is not one smaller in negative answer but it still negative: __»> 17 // -17 __-1

–When using modulo,the sign of the result matches the sign of the divisor (The second operand): __»> -17 % 10 __3 __»> 17 % -10 __-3

Remark: Both interpretation of // and % work with the relation: (b *(a // b) + a % b) is equal to a

My referance is:

Thank you, Michel Lemay.

PS: The line in the tables and other places is only to get the good position.

11 Mar 2013, 23:38
Christoph (1 post)

Do you see any significant hurdles when giving this book to someone who learns Python 2?


13 Mar 2013, 14:28
Valentine Chaluke (1 post)

Hi, there!

On p.39 9th line, The function body is indented. Here, we inded…

May be inded is just a typo.

Thank you for the book and the course. You are great!

13 Mar 2013, 20:38
Diolinda Monteiro (1 post)

I am signed up for your upcoming class in Coursera and am finishing your fundamentals course (I missed the deadline for taking that one live). Reading through your textbook has been very helpful. I was wondering if you have any plans to include an answer key to your exercises in the book?

Thank you for teaching and I look forward to your next class on Coursera!

15 Mar 2013, 01:07
Paul Gries (46 posts)

Hey all, thanks for the errata reports! If you wouldn’t mind, would you please report them here?

The first line has a “submit it” link.

Michel, thank you for the suggestions about % and negative operands. We’ll take another close look at that after we get two more chapters produced, which we want to do before the end of March.

Christoph: on the surface, there are only a few important changes. The most visible two are these:

  • @print@ is now a function. That means that you’d use this: @print(‘a string’)@ instead of this: @print ‘a string’@.
  • Dividing one int by another now produces a floating-point value. For example, @3 / 4@ produces .75. To do integer division, use @//@: @3 // 4@ produces 0.

Valentine: good catch. And thank you so much for the compliment! It made me smile. :-)

Diolinda: we’re excited (and nervous!) about LTP2. I’m glad you’ve been able to work through the first course. We do plan to include an answer key, but we’ll probably wait until after the book is officially published because we’re adding, changing, and removing exercises as we do the beta.

22 Mar 2013, 00:08
Jessica M. Bell (1 post)

[SOLVED] I was able to get the transaction to work by using a different pay method.

I also signed up for the Coursea part 2 course that starts soon and I am looking at the previous course as well to be ready for class soon. I am having a problem purchasing the second edition book. My order will not go through and I have verified everything twice with my bank and the bank tells me that problem is with this site. I have email customer service at the support email address and I keep trying to talk to a live person to speak about this matter. I am enjoying part 1 of the course and would really like to take part 2. this day 2 (and counting) in trying to resolve this matter. Any ideas or help will be much appreciated. Thanks for anyone who helps me.

09 Apr 2013, 23:12
Richard Jovelin (2 posts)

I am having troubles importing modules that I create. For instance, following the example on page 107 of the PDF version of the book I get the following error message:

import temperature Traceback (most recent call last): File “<pyshell#0>”, line 1, in import temperature ImportError: No module named temperature

The book says modules can be saved in any folder. However, could this be due to the installation of Python? A path may be missing? I followed instructions given during LPT1 for installing Python. This happens for any .py file that I creates but I have no issue importing other Python modules like math or imp. Thanks for your help.

17 Apr 2013, 00:56
Jennifer Campbell (17 posts)

Richard, are you getting this error when you try to import temperature in the Python shell? If so, trying opening and running first. Are you able to import it now?

If you are importing temperature in another file, then should be saved in the same directory as that file.

17 Apr 2013, 01:00
Jennifer Campbell (17 posts)

Lt Commander, this book is not available through Coursera.

07 May 2013, 17:50
Richard Jovelin (2 posts)

Jennifer, thanks for the reply. Yes I get the error message when trying to import modules from the Python shell. However, if I first run a module located in a given folder then I can import any modules located in the same folder. Also, I can important modules without having to run them first if they are located in the folder site_packages of the Python lib directory. This seems somewhat inconvenient to have to store modules here though. I’d like to keep modules related to one another in a same directory. Is there a way to import modules without to 1) have them in the site_packages folder and 2) having to run them first?

24 May 2013, 02:10
Antonio Guerrero (1 post)

To the Authors: I just enrolled to “Learn to Program: The Fundamentals” at coursera and would like to know how long you are gonna have those courses/classes open, before I buy your book. Thanks.

12 Jul 2013, 14:50
Paul Gries (46 posts)

We’re planning on leaving the current one open until we re-run LTP1, which we’re hoping to do in August.

You must be logged in to comment