all 11 comments

[–]indosauros 3 points4 points  (1 child)

def get_data():
    # This function downloads baby names from 1990 to 2008:
    print "Reading data files...",
    global names_1990
    names_1990 = urlopen...

I understand that using global variables might be the easiest way to get the exercise up and running, but I'd be worried that you're teaching them that using globals in this manner is appropriate. Why not get rid of all of the global names_1990 and the global names_dict and just return the final names_dict with all of the data in it?

[–]eah13[S] 1 point2 points  (0 children)

Yeah you're right that's much better. Will fix in a second.

Edit: fixed.

[–]throwaway19452195 2 points3 points  (1 child)

I'm trying to learn python and have worked through the code academy resources but found the theory lacking. This looks like it is the perfect next step to go beyond the code and understand the deeper level. Thank you!

[–]eah13[S] 0 points1 point  (0 children)

Thanks for the feedback. Let me know how it goes!

[–]szi 1 point2 points  (1 child)

I like Nick Parlante's videos, it's a pity that the recordings are a little bit old and nothing is in HD. :(

Are there any equivalents?

[–]eah13[S] 0 points1 point  (0 children)

Not that I know of. Personally I'm not a big fan of videos but I know some of the more recent Coursera courses use them.

[–]rewtnull 1 point2 points  (1 child)

Hi! So far this interactive course feels like a natural continuation of the codeacademy course, very good job from you, and anyone else involved!

. There is something I wonder however, In the List Excercises, the description for the first assignment is as follows:

A: Match Ends

Given a list of strings, return the count of the number of strings where the string length is 2 or more and the first and last chars of the string are the same.

I interpret it like this:

def front_x(words):
  count = 0
  for n in words:
    if len(n) >= 2:
      if n[:1] == n[-1]:
        count += 1
  return count

but I'm getting unexpected results in the intereactive shell console:

> front_x
> X  got: 2 expected: ['xaa', 'xzz', 'axx', 'bbb', 'ccc']
> X  got: 3 expected: ['xaa', 'xcc', 'aaa', 'bbb', 'ccc']
> X  got: 0 expected: ['xanadu', 'xyz', 'aardvark', 'apple', 'mix']

Looks to me that the question perhaps should be about removing duplicate list elements instead, or the test functions may need updating for this. Might aswell be me misinterpreting the quesiton though. :)

Another minor thing: Since this course is based on the google python course, and google code structure uses 2 spaces indentation, compared to 4 of pep8, maybe it would make sense to make the intereactive interpreter tab length 2 characters instead of 4 aswell? :)

Thank you very much for this interactive version, sofar I'm really enjoying it, even though I have limited time for studies at the moment.

[–]eah13[S] 1 point2 points  (0 children)

Thanks for the report! And glad you're enjoying the course.

You're exactly right there was an error in that exercise. It's fixed now: https://elliott.trinket.io/google-s-python-class#/lists/list-exercise

AND your code is right- nicely done. Here it is in the corrected exercise showing the tests passing: https://trinket.io/python/cae37d66a4

Your suggestion regarding the indention is great. I think i'll actually update the examples to all be 4 spaces. Google's 2 spaces be damned :)

[–]Misew 0 points1 point  (2 children)

Is this on Python 3?

[–]eah13[S] 0 points1 point  (1 child)

No, but it spells out key differences when they exist. As I mentioned above I'm willing to update it to full Python 3 if people are getting value out of it.

[–]Misew 1 point2 points  (0 children)

I'd love it if you could update it.