W2_Ex-8_Problems with costs

You are missing the point. Hard-coding is never a good idea. This is all about how functions work and the semantics of procedure calls. You don’t have to look at the test case code. All you need to know is the local variables in the “scope” of the model function. What are the parameters that are passed to model? They contain all the information you need.

Yes, looking at your language list, I think the problem is that you’ve never used a language that depends heavily on functions. That is absolutely central and critical in all modern programming languages. FORTRAN is the 1950s and VisualBasic is not really a full language. I don’t know APL, but I’ve got a bad feeling.

I suggest you google “python function” and “python parameter passing” and spend a few hours getting familiar with those ideas. Also “python variable scope” is crucial to understand.

Or you could do as I suggested a while back: pause this course and take an actual python course first.

OK. Will do.

BTW - APL stands for A Programming Language, which was invented by Ken Iverson in the early 60s. It is interpreter based, is symbolically oriented, and was my first introduction to vectorization. You could do things in 2 or 3 lines of code that would require lots of looping in FORTRAN - from my very old days as a life insurance actuary.

Oh, and regarding an actual python course - should I do it via Coursera, or are there more (and/or better) choices on other platforms?

Sorry, I don’t have any personal exposure to the alternatives there. I know there are some python courses on Coursera. Univ of Michigan has a series. And here’s one from Google. You can also just start with tutorials on python.org.

Or just go to Coursera and search for python, which is what I did to find the two links above. There are quite a few.

Thank you. I shall return.