python programming help

Y

YBM

Le 08.12.2013 20:06, (e-mail address removed) a écrit :
i get it, thanks a lot i wrote a different one and it works

def people(age):
people=[name for name in dic if dic[name]==age]
print(people)

No it doesn't. You are printing things not returning something.

and combine_list is the most stupidest function you could write
in Python, as it is built-in with the name 'zip'.
name = ['Alice', 'Bob', 'Cathy', 'Dan', 'Ed', 'Frank', 'Gary', 'Helen', 'Irene', 'Jack', 'Kelly', 'Larry']
age = [20, 21, 18, 18, 19, 20, 20, 19, 19, 19, 22, 19]
dic = dict(zip(name,age))
def people(age):
... ''' How stupid it is to write three line for a one-line
function'''
... return [name for name in dic if dic[name]==age]
...['Gary', 'Alice', 'Frank']

Sorry for having being rude, but :
1. you shouldn't post raw homework in any kind of public group
(aren't you supposed to learn something by yourself ?)
2. your teacher is a nut.
 
Y

YBM

Le 08.12.2013 19:32, (e-mail address removed) a écrit :
Welcome to the python list. Thanks for posting a question.



If you were hoping for one of us to write the program for you ... well

that's not what we do on this list.



Please post the code you have so far and tell us exactly where you need

help.



Also tell us what version of Python, what OS, and what you use to write

and run Python programs.

name = ['Alice', 'Bob', 'Cathy', 'Dan', 'Ed', 'Frank', 'Gary', 'Helen', 'Irene', 'Jack', 'Kelly', 'Larry']
age = [20, 21, 18, 18, 19, 20, 20, 19, 19, 19, 22, 19]
dic={}
def combine_lists(name,age):
for i in range(len(name)):
dic[name]= age
combine_lists(name,age)
print dic

def people(age):
people=lambda age: [name for name in dic if dic[name]==age]

people(20)




this is the code i have so far(with the help of the first post ;p). i understand how a function and a dictionary works and what I'm asked to find. but i don't get the lambda age part. and this code doesn't give me any result


You didn't write a function which return a result, so you have no
result.
 
C

Chris Angelico

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.

Neither. I don't at all hate Google (I quite like the company, and
what it's done for the world), and I use plenty of other Google
services - as you can see, I'm posting from gmail here. The only thing
I call out against is Google Groups, because it is buggy. I'll cry out
against anything else that's buggy, too. Of course, I'll first try to
do things quietly (bug reports to the maintainers), but ultimately,
the solution to buggy software is to NOT USE IT. If Google doesn't
care enough about Groups to bring it up to the standard, then their
penalty has to be reduced usage. In fact, Rurpy, you are actually
encouraging the faulty system, because you're providing ad impressions
and usage stats every time you read or write via GG. When less-buggy
systems see more use than more-buggy systems, big companies have an
incentive to fix bugs.

ChrisA
 
R

rurpy

[...]
To the OP, please ignore the above, it's sheer, unadulterated rubbish.
Nobody has ever been bullied into doing anything. People have however
been asked repeatedly to either A) use the link referenced above to
avoid sending double spaced crap here from the inferior google groups
product or B) use an alternative technology that doesn't send double
spaced crap.

Mark, I appreciate your calm and reasonable requests for people
to checkout the page you gave a link to, that's why I repeated
your advice. It is also why I responded to Chris and not to you.

However it does not change the fact that people here have responded
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than
to subscribe to a usenet provider or to a mailing list. One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have
had no complaints about in other places.
 
R

rurpy

Neither. I don't at all hate Google (I quite like the company, and
what it's done for the world), and I use plenty of other Google
services - as you can see, I'm posting from gmail here.

If the shoe doesn't fit, don't wear it. There have certainly
been others who have publicly railed against Google.
The only thing
I call out against is Google Groups, because it is buggy.

And yet you are publicly on record as referring to GG users
as "twits".
I'll cry out
against anything else that's buggy, too. Of course, I'll first try to
do things quietly (bug reports to the maintainers), but ultimately,
the solution to buggy software is to NOT USE IT. If Google doesn't
care enough about Groups to bring it up to the standard, then their
penalty has to be reduced usage. In fact, Rurpy, you are actually
encouraging the faulty system, because you're providing ad impressions
and usage stats every time you read or write via GG. When less-buggy
systems see more use than more-buggy systems, big companies have an
incentive to fix bugs.

We all use buggy software every day. *Every* piece of non-trival
software is buggy -- you already know that. So you are saying
that bugs that annoy *you* are ones that *others* should change
their practice to join your boycott to fix.

You sound like some Unix hard-asses of the 1990's who, by god, weren't
going pollute their software with any kind of MS Windows compatibility.
No supporting a broken OS for them. They would keep the software pure
and Unix-only and force Microsoft to fix their broken OS.
Well, most of that software and those programmers have been eliminated
by Darwinian selection, and today cross-platform (or Windows only)
software is the norm.

So good luck on your crusade to force Google to do things the way
you think is right. (Especially given the large and growing number
of Python project mailing lists *hosted* on Google Groups.)

Until you're successful, I will try to encourage GG users to post
more compatibly to avoid pissing off the old farts, do what I can
to support Rusi's attempt to put together a tool to make it easier
to do so, and finally, live with double-spaced "crap" because that
is the lesser of two evils, the other being creating an excessively
picky and hostile place for newcomers who just want to learn more
about Python.
 
R

rusi

On 12/08/2013 12:17 PM, Chris Angelico wrote:
[...]
To the OP, please ignore the above, it's sheer, unadulterated rubbish.
Nobody has ever been bullied into doing anything. People have however
been asked repeatedly to either A) use the link referenced above to
avoid sending double spaced crap here from the inferior google groups
product or B) use an alternative technology that doesn't send double
spaced crap.
Mark, I appreciate your calm and reasonable requests for people
to checkout the page you gave a link to, that's why I repeated
your advice. It is also why I responded to Chris and not to you.

Yes agreed.
However it does not change the fact that people here have responded
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than
to subscribe to a usenet provider or to a mailing list. One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have
had no complaints about in other places.

About the last -- no complaints about (that) in other places -- Ive recently
seen that on the html/stylesheets/javascript lists (not sure which)
there are also annoyed complaints about GG.

About the rest -- when people get annoyed they say and do things they
would not otherwise do. The sensible not-yet-annoyed-enough-to-lose-the-head folks should try to cure the annoyance rather than get
annoyed with it -- dont you think?

In short if we are programmers we should be thinking bug-fixes when we
are bugged :) And what is put up here
https://wiki.python.org/moin/GoogleGroupsPython
(only yesterday BTW) is a dynamically loadable GG-bugfix.
 
C

Chris Angelico

However it does not change the fact that people here have responded
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than
to subscribe to a usenet provider or to a mailing list. One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have
had no complaints about in other places.

Please note though that there is a difference between describing the
users as twits and describing the posts as slimy. Suppose you write a
letter (the sort that goes on a slab of dead tree) and, instead of
placing it in an envelope and putting a stamp on it, you hand it to
the Arac News Insertion Device[1] to do the enveloping for you. He
does a reasonable job of it, but he uses cobwebs instead of paper for
the envelope. Sure, it's still readable... but your readers now have
to rub off a whole lot of cobwebs before they can read what you said.
That makes your post distasteful, without it being at all your fault -
other than choosing to use Arac's service. That's how I see Google
Groups posts. Someone's gone looking for help about Python and has
found that. It's not their fault that they don't know about
alternatives; so I point out the alternatives.

ChrisA

[1] http://math.boisestate.edu/gas/princess_ida/webop/pi_04.html
On the whole we are
Not intelligent...
 
C

Chris Angelico

We all use buggy software every day. *Every* piece of non-trival
software is buggy -- you already know that. So you are saying
that bugs that annoy *you* are ones that *others* should change
their practice to join your boycott to fix.

The ones that have interoperability problems are the ones that need to
be fixed. When a MUD client uses CP-1252 instead of either Latin-1 or
UTF-8, that's a fault in it. (Confession: My own RosMud has that exact
problem, because of what it uses under the covers for screen display.
But it's being retired in favour of Gypsum, which supports full
Unicode and defaults to UTF-8 transport.)
You sound like some Unix hard-asses of the 1990's who, by god, weren't
going pollute their software with any kind of MS Windows compatibility.
No supporting a broken OS for them. They would keep the software pure
and Unix-only and force Microsoft to fix their broken OS.
Well, most of that software and those programmers have been eliminated
by Darwinian selection, and today cross-platform (or Windows only)
software is the norm.

And there were Microsoft people in the same era who, by Bill, weren't
going to pollute their software with any kind of standards
compatibility. Let's look at just one product, Internet Explorer:

IE6: Microsoft enjoys a near monopoly and uses this to encourage
people to use IE-only features Myriad intranet sites get set up that
won't work properly on any other browser.

IE7: Other browsers now actually have some market-share, and people
are agitating for IE to match them in behaviour. Oh dear. Guess we'd
better add tabbed browsing, everyone else has it... the monopoly isn't
enough to maintain itself on its own.

IE8: Actually, it looks like standards compliance is becoming
important. But so is compatibility with IE6. What a pain, what a pain.

IE9 and IE10: The market shift to other browsers and thus the pressure
shift to standards compliance continues. Unfortunately, it's just not
possible to maintain IE6 compatibility, so lots of corporates have to
keep XP and IE6 for their daily use.

(I was in a Subway buying a sandwich a few weeks ago, and the system
was having trouble. Guy was on the phone to the US trying to get it
sorted out. Everything was in IE6. I pity them.)

Windows-only is hardly the norm. There's at least as much software
that's Mac-only or Linux-only as Windows-only. And far far more that's
cross-platform or at least multi-platform. The most important thing is
interoperability - sometimes that means stuff like Samba (specifically
written to talk to a "foreign" system), but more often it means coding
to the pre-written standards. I can write all sorts of TELNET servers
and clients, and I can be confident that they'll work nicely with
other people's clients and servers, and that they'll understand each
other when they say IAC DO NAWS or IAC SB TERMTYPE IS "Gypsum" IAC SE.
If one of them is buggy, it must be fixed, or it must not be used.

ChrisA
 
M

Mark Lawrence

On 12/08/2013 12:17 PM, Chris Angelico wrote:
[...]
To the OP, please ignore the above, it's sheer, unadulterated rubbish.
Nobody has ever been bullied into doing anything. People have however
been asked repeatedly to either A) use the link referenced above to
avoid sending double spaced crap here from the inferior google groups
product or B) use an alternative technology that doesn't send double
spaced crap.

Mark, I appreciate your calm and reasonable requests for people
to checkout the page you gave a link to, that's why I repeated
your advice. It is also why I responded to Chris and not to you.

However it does not change the fact that people here have responded
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than
to subscribe to a usenet provider or to a mailing list. One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have
had no complaints about in other places.

Well you can ask iMath, amongst others, not to send double spaced google
nonsense. They've been asked repeatedly, politely, but apparently have
no consideration at all for people who have no interest in seeing this
ill formed dross spread throughout web land.
 
T

Travis Griggs

On 09/12/2013 00:08, (e-mail address removed) wrote:
On 12/08/2013 12:17 PM, Chris Angelico wrote:
[...]
To the OP, please ignore the above, it's sheer, unadulterated rubbish.
Nobody has ever been bullied into doing anything. People have however
been asked repeatedly to either A) use the link referenced above to
avoid sending double spaced crap here from the inferior google groups
product or B) use an alternative technology that doesn't send double
spaced crap.

Mark, I appreciate your calm and reasonable requests for people
to checkout the page you gave a link to, that's why I repeated
your advice. It is also why I responded to Chris and not to you.

However it does not change the fact that people here have responded
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than
to subscribe to a usenet provider or to a mailing list. One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have
had no complaints about in other places.

Well you can ask iMath, amongst others, not to send double spaced google nonsense. They've been asked repeatedly, politely, but apparently have no consideration at all for people who have no interest in seeing this ill formed dross spread throughout web land.

As long as we’re in full scale rant drift, I’d like to remind others of the time honored tradition of changing the post subject, when, er, uh, the subject changes. Because this obviously is not "programming help" anymore.

The python mailing list is the only one I know of that is cross posted between 3 different technologies. Maybe it’s an outgrowth of the “multi paradigm” philosophy of python or something.

It would be an interesting experiment, to shut down the cross forum replication engines for a month. Personally, I think they should each thrive, or die, on their own. If there’s enough mass on the groups to answer the occasional one off question, it’ll go on, indifferent of the existence of the mailing list. Comp.lang.python can truly become a troll haven. :) And the mailing list can be for the more thorough threads, or something.

If you’re worried about “fragmentation”… these weekly rants seem to indicate it’s happened anyway, and the impedance mismatch between styles/technologies/formats is generating more heat from friction than it is contributing light to the cross-sharing. Besides, there’s nothing stopping periodic posts being sent to any of the sites saying “by the way, did you know there’s also a mailing list…”

The nice thing about doing it for a month (or so), is that it’s not a “huge disturbance in the force.” If it stinks, you turn them back on in a month (or so).

<tongue in=“cheek”>If you’re still not sold, and find yourself solidly in the “keep it all together” group, I propose, we embrace that idea, and set up a bi-directional engine between the IRC channel (which I’ve found very helpful often) and the mailing list. </>
 
R

rusi

As long as we’re in full scale rant drift, I’d like to remind others
of the time honored tradition of changing the post subject, when,
er, uh, the subject changes. Because this obviously is not
"programming help" anymore.

<snipped>

I believe you are missing what's actually at issue here.

Lets just look at this thread:

New poster asks help for a homework problem without saying so

Different list members express concern/annoyance with this

[NO technological (3 different technologies) issues here yet]

This -- annoyance+answers -- continues for while until it morphs into GG-annoyance

The *context* of the earlier annoyance -- kid asking for homework help
without clearly saying so -- is lost in the GG annoyance.

Now GG is clearly annoying
As are kids who ask for homework help without saying so

¿¿Whats the connection??
 
R

rusi

I believe you are missing what's actually at issue here.
Lets just look at this thread:
New poster asks help for a homework problem without saying so
Different list members express concern/annoyance with this
[NO technological (3 different technologies) issues here yet]
This -- annoyance+answers -- continues for while until it morphs into GG-annoyance
The *context* of the earlier annoyance -- kid asking for homework help
without clearly saying so -- is lost in the GG annoyance.
Now GG is clearly annoying
As are kids who ask for homework help without saying so
¿¿Whats the connection??

I should have mentioned/asked: Are you using Google Groups to post?

Your post suffers from one of GG's annoyances – long lines.

If you are using it then I wonder about the *content* of your complaint
If you are not – and the *form* of your post still has a classic-GG nuisance –
then it weakens the anti-GG case.
 
R

Roy Smith

Travis Griggs said:
The python mailing list is the only one I know of that is cross posted
between 3 different technologies. Maybe it¹s an outgrowth of the ³multi
paradigm² philosophy of python or something.

Usenet is not a bicycle.
 
R

Roy Smith

rusi said:
<snipped>

I believe you are missing what's actually at issue here.

Lets just look at this thread:

New poster asks help for a homework problem without saying so

While it's good nettiquette, I suppose, to state that your question is
about a homework problem, it's rarely necessary. They pretty much
announce themselves :)
 
C

Christopher Welborn

"it has to be in the form of a function called people", that made me
laugh. Too bad he got an answer, even worse he doesn't know what to do
with it.
 
R

rurpy

However it does not change the fact that people here have responded
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than
to subscribe to a usenet provider or to a mailing list. One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have
had no complaints about in other places.

Please note though that there is a difference between describing the
users as twits and describing the posts as slimy. Suppose you write a
letter (the sort that goes on a slab of dead tree) and, instead of
placing it in an envelope and putting a stamp on it, you hand it to
the Arac News Insertion Device[1] to do the enveloping for you. He
does a reasonable job of it, but he uses cobwebs instead of paper for
the envelope. Sure, it's still readable... but your readers now have
to rub off a whole lot of cobwebs before they can read what you said.
That makes your post distasteful, without it being at all your fault -
other than choosing to use Arac's service. That's how I see Google
Groups posts. Someone's gone looking for help about Python and has
found that. It's not their fault that they don't know about
alternatives; so I point out the alternatives.

Nevertheless, that kind of strong judgmental language is
very likely to be taken as reflecting at least in part on
the poster, especially when the person is from a different
culture or unsure of their English skills.

And if you truly just want the poster to be apprised of
alternatives, I sure you'll grant me the right to point out
the alternative you consistently leave out: the option to
continue to use Google Groups.
 
R

rurpy

We all use buggy software every day. *Every* piece of non-trival
software is buggy -- you already know that. So you are saying
that bugs that annoy *you* are ones that *others* should change
their practice to join your boycott to fix.

The ones that have interoperability problems are the ones that need to
be fixed. [...snip stuff about mud clients...])

Huh? You declare a universal truth that interoperability bugs
need to be fixed but other bugs don't? A bug that give wrong
financial results is less important than mojibake sometimes
displayed on a web page? A bug that cause a connection failure
is more important than a bug that silently corrupts saved data?
Congratulations, you just won this week's jmf prize (with apologies
to jmf.)
And there were Microsoft people in the same era who, by Bill, weren't
going to pollute their software with any kind of standards
compatibility.

I don't think that is analogous in the same way.

Unlike most people here, who seem to be driven by an personal
(and emotional judging from the language used) distaste for
GG posts, and a similar emotional response against MS by the
Unix elitists in the 1990s, Microsoft's alleged "embrace,
extend, extinguish" policy was/is (I'm pretty sure) carefully
thought out and based on rational analysis.
Let's look at just one product, Internet Explorer:
[...snip MSIE version history claiming decreasing market share
and increasing standards compliance...]

Not a convincing example at all. First its not even clear that
what the factors driving such change are; open standards are only
one factor. Not should you assume that all open standards are
equally important and that MS' (or Google's) response will be
the same to all standards across all product lines.

Two, although you present MSIE as changing in response to demands
to "match [other browsers] in behaviour" you leave out demands on
those other browsers (and standards) to adopt features of MSIE.
A unfortunate example might be the W3C consideration (maybe approved
by now?) of DRM. It is not a one-way street and standards are
not cast in stone.

Finally it is an absurd stretch to take pressure applied by large
corporate customers to MS to adopt more open standards as comparable
to a handful of people in a non-major programming language mailing
list refusing to read posts from GG.

I am not saying that you shouldn't continue to promote your boycott
against Google, just that you shouldn't be surprised or get angry
when the response of some people is similar to my response towards
some friends who want me to stop eating meat to fight factory farming.
Windows-only is hardly the norm. There's at least as much software
that's Mac-only or Linux-only as Windows-only.

As much Mac-only software as Windows-only? Possibly, but I doubt
it although I acknowledge things are moving in that direction.
As much Linux-only software as Windows-only? You must be smoking
crack. :)
And far far more that's
cross-platform or at least multi-platform. The most important thing is
interoperability - sometimes that means stuff like Samba (specifically
written to talk to a "foreign" system), but more often it means coding
to the pre-written standards. I can write all sorts of TELNET servers
and clients, and I can be confident that they'll work nicely with
other people's clients and servers, and that they'll understand each
other when they say IAC DO NAWS or IAC SB TERMTYPE IS "Gypsum" IAC SE.
If one of them is buggy, it must be fixed, or it must not be used.

TELNET? Does any one still use that except perhaps on secure,
controlled legacy intranets? We nuked that and other protocols
of it's era (FTP etc) for ssh and other (more) secure protocols
ages ago.
 
R

rurpy

]
However it does not change the fact that people here have responded
in rather extreme way to GG posts including calling GG users "twits"
and claiming GG posts damage their eyesight, as well as repeatedly
denying the obvious fact that GG is much easier to use for many than
to subscribe to a usenet provider or to a mailing list. One frequently
sees words like "crap", "slimy", "rubbish" etc to describe GG posts
which is pretty intimating to people who just want some help with a
python question using a tool they already know how to use and have
had no complaints about in other places.

About the last -- no complaints about (that) in other places -- Ive recently
seen that on the html/stylesheets/javascript lists (not sure which)
there are also annoyed complaints about GG.

I am sure that there are other usenet groups that get Google
Groups posts and find them irritating for the same reason
that some here do. But usenet is nearly all the way in death's
door (at least text groups; binaries groups may be still be
growing.) The only usenet groups I know of with any vitality
left at all are ones like the Python list that are backed by an
active maillist. (Curiously, it seems to me the dramatic decline
in usenet occurred around 2008-2010, about the same time as
the dramatic rise of social networking sites.)

As for pure mailing lists, I am not sure how many are gatewayed
to GG -- I subscribe to several because they are not available
through GG -- so they don't get GG posts.

There are however a large number of mailing lists that are
hosted solely on GG by various projects. It is participants
in these lists that I was thinking of by "other places".
Such people are likely very surprised by the hostility they
meet when they simply change to the python list (or one of
the other usenet-gatewayed groups) which looks very much
like any another GG group from their perspective.

For all the GG hostility on the python list, many python
project lists are hosted on GG (Sqlalchemy, Webpy, GvR's
own Tulip project, etc)
About the rest -- when people get annoyed they say and do things they
would not otherwise do.

Humans have big cortexes so that they don't need to act out
based on their feelings of the moment -- like a dog humping
the boy next door or trying to bite off the arm of the
postal delivery person.
 
C

Chris Angelico

As much Mac-only software as Windows-only? Possibly, but I doubt
it although I acknowledge things are moving in that direction.
As much Linux-only software as Windows-only? You must be smoking
crack. :)

Or just using Linux. Stuff that runs only on Linux is actually a bit
of a problem at times - coders making assumptions about the
environment that aren't guaranteed, and merely happen to be correct on
all current versions of the Linux kernel.
TELNET? Does any one still use that except perhaps on secure,
controlled legacy intranets? We nuked that and other protocols
of it's era (FTP etc) for ssh and other (more) secure protocols
ages ago.

TELNET protocol is the fundamental basis of MUDs. Doesn't mean there's
a TELNET server at the other end.

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top