Dear Xinyue,
Please use SAM's code generator to create the MATLAB and Python code files instead of using the examples that come with the SDK. The code generator is up to date, and will generate code and supporting files for Python 2 and 3. It also ensures that you assign values to all of the required inputs.
You can find a quick video showing how to use the code generator under "How-to Videos" here:
sam.nrel.gov/webinars
There are also numerous discussions about Python, which you can find by searching the website for "Python":
sam.nrel.gov/search/site/python
Best regards,
Paul.