While doing the code assignment for the compute cost part, I tried to run the code and this came out. Can anyone help me with this? Thanks in advance
Hi @Elise_Poniman,
The error indicates that the cost variable that your compute_cost function produces is an array, which should have been a float type instead. You may start debugging from here.
Raymond
The variable cost that you calculated outputs an array, but it should be a scalar.
The string formatting part (the .3f) in the print statement requires a scalar. That’s why it yields the TypeError. Please check the output of your function compute_cost.
Hi @Elise_Poniman , I am closing this thread, please open a new one if you have any follow-up.
Raymond

