Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   help (http://www.velocityreviews.com/forums/t956422-help.html)

kwakukwatiah@gmail.com 01-10-2013 06:35 PM

help
 
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

Hans Mulder 01-11-2013 11:51 PM

Re: help
 
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


All times are GMT. The time now is 10:52 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.