Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36622 > unrolled thread
| Started by | kwakukwatiah@gmail.com |
|---|---|
| First post | 2013-01-10 12:35 -0600 |
| Last post | 2013-01-12 00:51 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
help kwakukwatiah@gmail.com - 2013-01-10 12:35 -0600
Re: help Hans Mulder <hansmu@xs4all.nl> - 2013-01-12 00:51 +0100
| From | kwakukwatiah@gmail.com |
|---|---|
| Date | 2013-01-10 12:35 -0600 |
| Subject | help |
| Message-ID | <mailman.398.1357912204.2939.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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
[toc] | [next] | [standalone]
| From | Hans Mulder <hansmu@xs4all.nl> |
|---|---|
| Date | 2013-01-12 00:51 +0100 |
| Message-ID | <50f0a569$0$6955$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #36622 |
On 10/01/13 19:35:40, 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
How about:
database = dict(Mac=1000, Sam=2000, Eric=3000, Terry=4000, Graham=5000)
name = raw_input('Enter your name: ')
if name in database: print "Your pay is ${}".format(database[name])
Hope this helps,
-- HansM
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web