>     minus_weekends=hourly_income*64
>     total_income=int(minus_weekends-sum_of_monthly)

Here's problem number 1 - you're taking the values the wrong way around :)
It should be total_income=int(sum_of_monthly-minus_weekends)

>     sum_of_monthly=int(yearly_income/12)

Here's the second problem you encountered. The problem derives from
the fact that the operation is using two integers, which returns an
integer. Integer division and the int function rounds down, as it were
- 7/6 will give you 1,  int(5.9) will give you 5. This gives you 16666
when you use 200000, due to rounding down, whereas the answer you want
is 200000/12.0 (16666.666666666668). I suggest you don't use int here
yet, and use 12.0 instead of 12, in order to get a float as you are
performing further operations with the result, which will suffer due
to a loss of accuracy.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to