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


Groups > comp.lang.python > #36624

Re: help

References <07AEBD8B16FA4C03A16257998C995B38@favour>
From Matt Jones <matt.walker.jones@gmail.com>
Date 2013-01-11 08:24 -0600
Subject Re: help
Newsgroups comp.lang.python
Message-ID <mailman.399.1357914311.2939.python-list@python.org> (permalink)

Show all headers | View raw


[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
>
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web