C1M1 Assignment - Exercise 2 - Failed test

When I run the test for Exercise 2 it says that there’s an “Incorrect value for available_copies”, however below it says the grader expected 3 and that I got 3. The output is exactly as expected, but I keep failing the test.

Any ideas?

Perhaps the grader uses a different test.

It would help if you post a screen capture image of the error message or grader feedback.

Here's the screenshot. I hope it helps

Thanks for the image.

Note: That output is not from the ‘grader’, it’s from the in-notebook test cases.

Hopefully a mentor for that course will stop by shortly. Since it’s on Coursera and I’m not a mentor for that course, I don’t have access to do any investigation on the issue.

Ok got it, thanks so much!

Hi @dianexgutierrez,

I’m going to DM you regarding this.

Hi @dianexgutierrez,

I took a look a your notebook, and saw the mistake you are making.

In simple words, you were expected to do an arithmetic operation, something like:

x = y - z

But what you are doing instead is, doing the operation, but then turning it into a string.

x = f"{y -z}"

If you don’t understand what I’m about to say, don’t worry, you’ll learn about it as you progress through the course, but when you use quotes ("") with a variable, it then becomes of type str (string).

So the issue here is that “x” needs to remain an integer, but you have turned it into a string type.

If you take a look in your notebook, you can see what I mean. I left some comments for you in there.

Best,
Mubsi

ohh ok got, I can see it clearly now.

Thanks so much!

DG

1 Like