On 12/08/2013 12:17 PM, Chris Angelico wrote: > On Mon, Dec 9, 2013 at 6:06 AM, <rafaella...@gmail.com> wrote:>[...] > Also, your posts are acquiring the slimy stain of Google Groups, which > makes them rather distasteful. All your replies are getting > double-spaced, among other problems. Please consider switching to an > alternative newsgroup reader, or subscribing to the mailing list: > https://mail.python.org/mailman/listinfo/python-list
To the OP: First, my apologies if my reply ends up trashing your discussion here, but you should know what is behind Mr. Angelico's response. For some time now the Google Group Wars are being fought in this group. There is a (probably very small) clique of Google haters who try present themselves as "the community" and who try to intimidate anyone posting from Google Groups into using some other means of posting, completely disregarding the fact that for many new people or occasional posters, Google Groups is an order of magnitude easier to use. These people are extremely noisy and obnoxious but *do not* represent "the community" except in their own minds. I suspect many of them are motivated by political dislike of Google as a corporation, or want to stay with the 1990's technology they invested time in learning and don't want see change. I and many other people post here from Google Groups and you should feel free to too if it is more convenient for you. (Of course you can also use the maillist or usenet if you find them a good solution for *you* but please don't feel compelled to by some loud obnoxious bullies.) As another poster pointed out, if you are able to follow some of the advice at, https://wiki.python.org/moin/GoogleGroupsPython it will help quiet down the anti-Google crowd a little but even if you don't, those without a Google chip on their shoulder will simply skip your posts if they find the Google formatting too annoying. Most of us though will deal with it as adults and try our best to answer your questions. I just thought you should have both sides of the story so to won't take the anti-Google crowd here as gospel. Addressing you last question, I presume you understood the other responses about replacing the "print (people)" statement in your people() function with "return people". The only additional thing I wanted to add is that, people=[name for name in dic if dic[name]==age] is (I would guess) a rather advanced way of doing what you are doing, given where you seem to be in learning about python (but maybe not, in which case ignore the following). The [....] thing is called as "list comprehension and in described here http://docs.python.org/3/tutorial/datastructures.html#list-comprehensions However, it is just a more concise way of writing: people = [] for n, a in dic.items(): if a == age: people.append (n) return people To understand the above (if you don't already) you'll want to read about the the items() method of dicts: http://docs.python.org/3/tutorial/datastructures.html#looping-techniques http://docs.python.org/3/library/stdtypes.html#mapping-types-dict the append() method of lists, http://docs.python.org/3/tutorial/controlflow.html#for-statements http://docs.python.org/3/library/stdtypes.html#mutable-sequence-types and of course "for" loops; http://docs.python.org/3/tutorial/controlflow.html#for-statements Hope this helps. -- https://mail.python.org/mailman/listinfo/python-list