Your code is correct and should work. It sounds like you might have used the keyword list as a variable name somewhere else in a previous screen in the same mission. You can read this post by @joshdq for more details.
@Mary Maybe the Variables And Data Types Mission in the Python Fundamentals course could be updated to include the info that Python keywords should not be used as variable names? Several users seem to have found this out the hard way.