C1M1_Assignment: 1-B: Print Statements:'Available Copies: 4':You got: an incorrect message

This code snippet:

(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not. You can share the errors you get)

Please edit your post.

Here’s a guide on how to edit a post.

Is getting the following error:

Failed test case: Missing correct printed message.
Grader expected: One copy of Brave New World checked out. There are now 3 copies available.
You got: an incorrect message

Exercise 3 has passed. What am I missing in exercise 2??

This is time sensitive as the due date is 11:59 cst 12/22 and it is currently 9:05.

This instruction in the code snippet wanted you to reduce the number of available_copies from 4 to 3, which you didn’t do. So you got failed test.

Regards
DP

Thank you for your response!

The instructions state the following:
Write a program that:

  1. Reduces the number of available_copies by 1 (representing a book being checked out).
  • The current available_copies for the book “Brave New World” are 4.

Does not reduce the number of copies?

I updated the the code so that:

(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not. You can share the errors you get)

and got the following output:

One copy of Brave New World checked out.
There are now 3 copies available.

and the same error:

Failed test case: Missing correct printed message.
Grader expected: One copy of Brave New World checked out. There are now 3 copies available.
You got: an incorrect message

The instructions state to:
Reduce the number of “available_copies” by a value of 1.

The current value is 4. If I reduce that value by 1, I would expect said value to be 3 which would result in:

available_copies = 3

What am I missing?

can you provide me the link here to the lesson here, so I can check the overall codes. Also I was mentioning to assign available copies =1 and then run, what output does it give them?

https://community.deeplearning.ai/t/c1m1-assignment-1-b-print-statements-available-copies-4-you-got-an-incorrect-message/739180/6?u=0gsl

Here is the exercise description followed by the code snippet . I have included the error returned after I run the code.

Your Task:

Write a program that:

  1. Reduces the number of available_copies by 1 (representing a book being checked out).
  • The current available_copies for the book “Brave New World” are 4.

(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not. You can share the errors you get)

One copy of Brave New World checked out.
There are now 3 copies available.

# Test your code!
test_your_code.exercise_2(available_copies)  

Failed test case: Missing correct printed message.
Grader expected: One copy of Brave New World checked out. There are now 3 copies available.
You got: an incorrect message

1 Like

your provided link isn’t opening, please provide me the lesson assignment title you are working on

Here is the browser link to the lab:

C1M1_Assignment: Exercise 2: Checking Out a Book

You will notice that that the message printed before I run the test you code line is identical to what what is printed in “Grader expected:…”

i don’t have access to this course.

But here is what you are suppose to do

you were suppose to reduce the available copies with statement function were available copies is a tuple value of a dictionary book title, so using just a numerical value will not change the value of available copies.

first use def statement to mention what is available copies (tuple value) in relation to the dictionary (book title), then to the iteration reduce the tuple value of available copies. Another approach is conversion of tuple into list in relation to the dictionary,and then reducing the tuple value using value item( )

I trust you when you say you do not have access however how are you to offer support without it? If you did, you would note that the lesson format does require me to reduce the available copies with statement function were available copies is a tuple value of a dictionary book title and to use def statement to mention what is available copies (tuple value) in relation to the dictionary (book title), then to the iteration reduce the tuple value of available copies.

Who can look into what appears to be a bug in this lesson?
Let me know who I can send screen grabs of the entire jupter notebook page to.

you can send me screenshots if you want. I can look upon the overall codes. But as I am not mentor for this course, I don’t have access to the course.

if I look at overall codes I can probably help.

Please don’t post any screenshots here where you must have written codes. it is only allowed to share codes by DM

Hi @0gsl,

First things first, you are not allowed to share the solution code on public forum. I have removed all you have shared.

You are allowed to share the errors you get, and if someone would need to take a look at your code, they will direct message you.

@0gsl,

As for your mistake,

You have to follow this and increment the value by 1, not put it 3 directly.

Later, you did follow this instruction, but you got the error because your output, which is

is in 2 lines. If you look at the expected output of this exercise, everything is in 1 line (this is why the error is telling you You got: an incorrect message)

Please make sure you follow the formats of all of the expected outputs, including periods (.)

1 Like

I passed all the preceding lessons and the one afterwards.
I have sent you screen grabs via email along with my concerns. Thanks for your your help.

i have send the answer in the personal DM conversation you sent code attachment.

Got it, sorry about that.