Last answered:

10 Dec 2020

Posted on:

13 Oct 2020

0

Feedback to Python Bootcamp further exercises (List Comprehensions)

There are two things I think are "wrong" with two of the answers. Not "wrong" as in they don't work, but wrong as in "poor answers given the target audience".
Answer 18. Here a completely new (to most people) syntax is introduced with no explanation whatsoever. Prior to this, all the work has been with the long form layout - which is easy to read and easy to understand for novices. Suddenly introducing "divisors = [i for i in range(1,num + 1) if num%i ==0]" with no discussion and no pointers for further learning is a bit of a tough ask. I had only seen the compact form as it was used in some of the StackOverflow questions I'd looked at which doing other questions.
Answer 20. It took me a few moments to work out how the given answer works. This is another example where the given answer will work, but it can be inefficient. A quick check shows that for small intervals of start-end then it's more efficient than the "traditional" approach*, but if the interval is not small relative to the scale of starting number, then it takes many more divisions. For example, with a range from 882 to 1000 the given solution is more efficient, but from 881 to 1000 is less efficient - and the change in iterations needed with cahnge in range selected is surprisingly large.
* Start at 2 with empty list, if number is not divisible by any member of list then add to list. So instead of testing division by 2,3,4,5,6,7,8,9,10,11,... you only test by division with 2,3,5,7,11,...

 

EDIT: after a bit more looking around, I see answer 18 is using a list comprehension. Surely something like this is deserving of it's own section in the course ?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

10 Dec 2020

0
Hi Simon,  thanks so much for your suggestion and for the valuable feedback. Our course authors have an individual approach towards programming, and we strive to make the experience as seamless and intuitive as possible for our students. I'd really love to hear if you have any further comments about this or any other course within our program. Or if you have any question on any topic.  Thank you Best,  365 Eli

Submit an answer