• #### thales

a solution ( dont forget to print the last on a new line!)

my code

my code

• #### Bolke

I wonder why my code doesn't pass muster? I tried it in TextPad, and it worked fine. Here, it doesn't....

• #### Learneroo

Sorry please make sure to print out the output for each game on its own line.

• #### Bolke

Sorry in return; I think I already fixed it.

a solution:

my code

• #### Weasel Bandit

It's not really efficient.. but it works...

• #### thales

THANK....... finally, it ook me half a day :-( really hard..

a solution:
my code

• #### Daniel Kozmacs

wow, so there's a simple way :) I've overcomplicated it I guess...
my code

last year I gave up here, so now I know why :D

a solution:

my code

• #### Daniel Kozmacs

Didn't know I'm able to use math.round, without it: my code.

a solution:

my code

• #### lyle

Can someone explain the challenge like I am 5?
I am not very good at this mortgage stuff and therefore I can't see the question properly.

• #### thales

One example to understand the question would be nice , yes.

• #### thales

It does not make sense. What if i payed the whole mortgage at once. In example 1 this will cost 106000 dollar. My fund will be 46500 dollar ( i first collect the rent). And done with it. right? Then the interest of the remaining 19 years will give me a total fund off 46500*1.0219=67741 dollar. Its a lot more then 11490?

• #### Learneroo

You need to pay \$5k + interest each year. The only decision is how much to sell from your mutual fund. (This is an 'alpha' challenge though, so don't worry about it too much.)

• #### thales

I do worry about it much. I want to do this. But i dont understand the question. Is there an example.. Can i sell all at onces or not? What happens when i sell?

• #### Learneroo

You can sell any amount at once (and save on fees), but you'll miss out on annual earning from your fund (`a`).

• #### thales

I am really sorry but i think your output is wrong. I i can sell everything at once, then for example one i have more then 11490 left.

• #### Learneroo

It's possible there's a mistake (it's an alpha challenge), but selling everything at once is not optimal, since you're giving up earnings in your fund, but still need to pay the same interest on mortgage.

• #### thales

No i i take al the money at once i can pay off my mortgage at once. I dont have to pay anything afther that. In example 1 the output then will bi higher. Try it for yourself. Example one, pay off everything at once. You will get a higher amount then what it says.

• #### Learneroo

As I mentioned, you need to pay \$5k + interest each year. You cannot pay off more than \$5k of the principal each year. The only decision is how much to sell from your mutual fund, not how much to pay for the mortgage.

• #### thales

Weird. Since the funds money i talk depends on the mortage. Nevermind, the question is still not clear. The rules arent clear to me at all.

But i give it up. Thx for the comments never the less!

• #### Gary

Very, very tough... I opted for the easier solution (:

my code

• #### Bolke

Hm, not getting it....You say "The only decision is how much to sell from your mutual fund".

But...you have a yearly income, and when the total sum you have to pay to the bank is larger than that income by x, then you have to sell off x from your fund. Where is there a decision in that?

• #### Bolke

And yes, like the others I feel there should have been one worked out example, like the challenges before this one had. Now I have no way of knowing whether my programming is wrong, or my understanding of the challenge.

• #### Bolke

my code

Dunno what's wrong with my code.

• #### thales

Isnt there an esier way to round up numbers to n decimal places?

a solution:
my code

• #### Bolke

We have to make a precision, for which there is no method? That's brutal.

• #### Bolke

I finally got the precision done, but only by copying and pasting a solution for that issue from Quora. It really would be helpful if we were led to a solution, sometimes. Right now I don't feel I'm learning from this.

• #### Learneroo

In this case, Googling for how to round numbers would be good practice for real world programming.

• #### thales

a solution:

my code

• https://www.learneroo.com/modules/49/nodes/293
Can anyone help me understand what I am doing wrong? I took the approach of saving the x and y values to their own arrays, and then iterating through

• #### Learneroo

See this post for an explanation of an optimal solution.

• #### thales

Holy Cr*** this was hard!

a solution:
my code

• #### thales

Is there a solution ( not explanation) that i can see. I got a solution but if this is a good one i really dont know. I want to know if there is a better way?