Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36624 > unrolled thread

Re: help

Started byMatt Jones <matt.walker.jones@gmail.com>
First post2013-01-11 08:24 -0600
Last post2013-01-11 08:24 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: help Matt Jones <matt.walker.jones@gmail.com> - 2013-01-11 08:24 -0600

#36624 — Re: help

FromMatt Jones <matt.walker.jones@gmail.com>
Date2013-01-11 08:24 -0600
SubjectRe: help
Message-ID<mailman.399.1357914311.2939.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Pay isn't linked to the "people" in any way.  A dictionary would serve this
purpose better (at least in this simple example).

database = {
    'Mac' : 1000,
    'Sam' : 2000
}

name = raw_input('Enter your name:')
if name in database.keys(): print "your pay is $", database[name]

*Matt Jones*


On Thu, Jan 10, 2013 at 12:35 PM, <kwakukwatiah@gmail.com> wrote:

>   pls this is a code to show the pay of two people.bt I want each of to
> be able to get a different money when they enter their user name,and to use
> it for about six people.
> database = [
>     ['Mac'],
>     ['Sam'],
>     ]
> pay1 = 1000
> pay2 = 2000
>
> name = raw_input('Enter your name: ')
> if [name] in database:print "your pay is $",pay
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web