Please add a tag indicating where you are taking the course. Choose only one of the platform options in the tag section then add the week/module.
Store the author Aldous Huxley of the book as a string
author = “Aldous Huxley”
NameError Traceback (most recent call last)
Cell In [55], line 2
1 # Test your code!
----> 2 test_your_code.exercise_1a(book_title, author, year_published, available_copies)
NameError: name 'author' is not defined
I keep getting an error message. what am i doing wrong
You need to run your code from the start of the notebook and keep running code cells in order of sequence. Please bear in mind that the notebook may not have auto save activated, be sure to save your work every time you finish coding a code cell.
If you run into problem and wanted to re-run you code in a clean state:
From the menu bar at the top of your notebook:
Kernel ->restart & clear all output
Cell → run all above (from your current cell)
From this error message, it looks like you might not have run the cell of code involving print statements, which is right before the cell “test_your_code.exercise_1b()”. As @Kic suggested, you could do:
Kernel ->restart & clear all output
Cell → run all above (from the cell test_your_code.exercise_1b, to run all cells above this in order, from top to bottom).
Alternatively, after “Kernel ->restart & clear all output”, you could manually run all cells one by one in order, starting from “import test_your_code” until you reach test_your_code.exercise_1b.
Subject: Grader Error in Exercise 1b — KeyError: ‘text’
Message:
Hi team,
I’m encountering a persistent error when running the grader for Exercise 1b in the notebook. My code runs correctly and prints the expected output:
Title: Brave New World
Author: Aldous Huxley
Published: 1932
Available Copies: 4
However, when I run , I get the following traceback: this is what i get, KeyError: ‘text’
I’ve already tried the following:
• Restarting the kernel and clearing all outputs
• Running all cells in order from top to bottom
• Ensuring the print statements are active and correctly formatted
• Running the notebook in the original Coursera environment
Despite this, the grader still fails with “You got: None” and throws the KeyError. It seems like the grader is unable to read the output from the previous cell.
Could you please advise or check if there’s an issue with the grader setup?
Thanks so much!
I am new and I am also, having problems with working on the assignment work area.
I wrote all the code of the assignment but I cannot run the code when I press shift enter on the test_your_code line. It is ridiculous to be stuck due to technicalities of the workpad area rather than being not able to code the assignment.
Can somebody please help with a video or a step by step instruction on how to use the assignment coding pad area. Otherwise I will have to cancel my subscription.
Dear Mubsi,
I am talking about the programming assignment ‘working with a library’.
I wrote down all the relevant code correctly but when I hit submit , the score came to
0/30.
For ref. I am copy pasting here
(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)
Also, what do you mean by ‘run ’ test_your_code’. I tried to hit ‘shift enter’ on this line after every assignment but I get eror
(this is what is written on top of the assignment) - where can I find the name of the notebook
please explain, what do you mean by ‘run’ , is it ‘shift enter’?
Do you mean I have to do a shift enter after writing every line of code.
How can start over fresh and submit again.
Appreciate your effort to explain.
Yes, you should see the name of the notebook at the very top. As you pointed out that you see C1M1_Assignment. That’s the correct notebook file you are working in.
Yes, by “run”, I mean “shift + enter”.
Yes, you have to do “shift + enter” for not just every line of code you write, but even for the code cells that contain existing code.
Dear Mubsi
I restored original version and tried again.
I passed excercise 1a, but got errors in 1b.
(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)
This is the error message I got…
(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)
could you tell me what is wrong.
I had saved the string variables in ex. 1a like this
(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 know, sharing solution code publicly is against the honour code of this community. Please refrain from doing that. You are allowed to share the error messages you get.
If I need to take a look at your code, I’ll ask for it myself.
With that being said, following seems to be the issues with your code:
Your Exercise 1-A is correct. No issues with it.
In your Exercise 1-B, it has the following errors in it:
You would have seen this as an error prompted in the notebook as well - your 3rd print statement uses Print (capital p) instead of print.
As per the exercise instructions and expected output, your print statements should be:
Title: ...
Author: ...
Published: ...
Available Copies: ...
But you are using Year Published instead of Published.
Fix these mistakes and you should be able to pass the tests.
dear Mubsi
For exercise 2 I am getting the following error message.
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
I am getting the print out with the last ‘e’ of the word ‘available’ in the second line though I put the code without wasting any space.
when I printed out the message in two lines , I still get an error message.
kindly look and tell me what is the issue
Rommel