Week 3 final practice lab

I’m new to coding and trying to understand all these error messages and defining everything. I am running into an issue where I have used the hints for help but keep having issue of “X_train is not defined” when running code to implement compute_cost. I have ran all cells and checked my work to see if it matches with hint and have found no differences but still run into NameError

Welcome to the community!

Tip: Every time you open a notebook, you have to run all of the code cells starting from the top.

That’s how the assets are imported and the workspace is configured.

= = = = = =

If you do not have any programming experience, you might consider attending a Python programming tutorial course. There are a lot of them available online (video channels), for free.

The course presumes that you already know the basics of Python programming.

I reran all the codes again and now I am getting a new error code in the area of the code than can not be edited

TypeError: unsupported format string passed to NoneType.format

Errors in the code you can’t edit means that it is a cell that tests your code, and an error is being detected.

This might be good or bad, depending on whether you have completed the code it is testing.

Tip 2: When you get an error message, please post a screen capture image that shows the entire error. It helps speed up the diagnosis process.

this is error i am seeing

This means the value returned by your compute_cost() function is not the correct size, shape, or type. The print() function is complaining that it can’t print the “cost” value using the “.3f” format specifier.

This is why having some Python experience is helpful. It’s a pretty common error message when using print().

Since the print() statement expects to print a floating point scalar value, I’d guess your compute_cost() function might be setting the cost as a vector instead of a scalar.

I used hints to implement code correctly and to run compute_cost for exercise 2 and ran code with no error when returning total cost

do you have any recommendations for changes to be made

Please post a screen capture image that shows a results that says there are no errors.

That image shows no test results.

It shows your code (which is not allowed by the Code of Conduct), and it shows a test cell but not its results.

Update: There appear to be formatting or indentation errors in the code (note the keywords that are highlighted in red font), along with some possible issues in using the ‘Hint’ code.