I need help to understand the Traceback message

Hi everyone,
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.

Hi!
The README instructions say:

If a list containing less than 9 elements is passed into the function, it should raise a ValueError exception with the message: “List must contain nine numbers.”

Here’s how to do that (from w3schools)…
https://www.w3schools.com/python/gloss_python_raise.asp

Happy coding :slight_smile:

1 Like

Thank you for reply,
I raised the ValueError

raise ValueError (“List must contain nine numbers”)

but there is no output

Hi…

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! :slight_smile:

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 :grin:

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 :grin:

thank you I fix it and it’s working now :+1:.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.