I have unexpected outcomes in exercise 5 and 6, and am struggling with fixing them. Here’s my code and outputs. Could anyone advise? Thanks.
Exercise 5
{moderator edit: code removed}
Exercise 6
{moderator edit: code removed}
I have unexpected outcomes in exercise 5 and 6, and am struggling with fixing them. Here’s my code and outputs. Could anyone advise? Thanks.
Exercise 5
{moderator edit: code removed}
Exercise 6
{moderator edit: code removed}
Please do not post your code on the forum. That is not allowed by the Code of Conduct.
I recommend you read the tips for this assignment, from the FAQ.
You can find it by using the forum search tool for “M4ML Resources FAQ”.
Thanks for your reply. Hmm, I believe you’re referring to this, but still cannot think of how I should fix the code.
The error says UnboundLocalError: local variable 'probability_f' referenced before assignment
, but that doesn’t make sense to me as I don’t think 'probability_f
is used before Exercise 6.
What that means is your code tried to use the probability_f variable before it ran any code that assigned it a value.
It has been sorted. Thanks.