On 30/04/16 16:30, Olaoluwa Thomas wrote:

> I've attached the scripts in question (created via Notepad++).

attachments often get stripped by the mail system as a security risk.
Since your code is very short just post it in the mail message
as plain text.

> The problem with this script is that the "else" statement (which is
> equivalent to the 1st script) does not compute gross pay accurately as seen
> in the attached screenshot.

The screenshot seems to have been stripped so we can't see it.
Just tell us what happened and what you expected. Or better
still cut 'n paste the output into the message.

> I would appreciate a logical explanation for why the "else" statement in
> the 2nd script isn't working properly.

It almost certainly is working properly, just not as you expected
it to :-)

When dealing with floating point numbers remember that they will
always be approximations to the whole number so calculations will
similarly result in approximations. Usually if you round the
results the figures will look ok.

I can't see anything obviously wrong in your code although
it could be simplified. Please post a sample including the
inputs and outputs. Tell us what you expect to see as well
as showing us what you do see.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to