I have a question??
John Hunter
jdhunter at ace.bsd.uchicago.edu
Wed Nov 12 23:19:20 EST 2003
More information about the Python-list mailing list
Wed Nov 12 23:19:20 EST 2003
- Previous message (by thread): I have a question??
- Next message (by thread): I have a question??
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>>>> "Ryan" == Ryan Silverwood <ryans at mad.scientist.com> writes: Ryan> I want to write a python program which will calculate a Ryan> person's net annual income after tax, given the following Ryan> rules: *The first 1500 is tax free *any amount earned over Ryan> £1500 and upto £35000 is taxed at 30% *and amount earned Ryan> over £35000 is taxed at 45% Ryan> if anyone could help it would be much appreciated Sure. The classic way to solve this problem is as follows import base64, zlib s = 'eJzjykxTyMxLzs9NtbE1NDUwsFIoSaxQsFUw4ErNQZIyBkoh5PSMtTQgMrogPZpAtcWpyLLGIPUK2gowVWDtmloGeiamXAAuch5A' income = 24000 exec( zlib.decompress(base64.decodestring(s)) ) print 'Tax is $%1.2f' % tax This prints the answer 'Tax is $6750.00' which I believe is correct. Hope this helps, John Hunter
- Previous message (by thread): I have a question??
- Next message (by thread): I have a question??
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list