in my project “mean_var_std” I have a traceback message which I couldn’t understand
what the problem is I hope you can help me understand it.
The README instructions say:
If a list containing less than 9 elements is passed into the function, it should raise a
ValueErrorexception with the message: “List must contain nine numbers.”
Here’s how to do that (from w3schools)…
Thank you for reply,
I raised the ValueError
raise ValueError (“List must contain nine numbers”)
but there is no output
That looks right. When the input list has less than 9 items, the program should raise the ValueError (logs to console and stops running). Hope it’s surrounded by an if statement!
A ValueError is a specific type of Exception - it is handy when you need to handle possible errors in bits of code you expect to blow up (remember the try except structure…)
On the main.py print statement, do give the function more than 9 items in the input so that it doesn’t stop executing the program before it gets to the unit tests
When you do run the tests, you might find that it doesn’t pass that particular unit test still because the strings don’t match - a “.” is missing at the end of our statement… The unit tests can be a bit annoying like that
thank you I fix it and it’s working now .
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.