# Check Variable Values

## Simple variable value

To check a variable value you need to import the student's code and use dot notation to get the value.

Example, maybe you ask students to assign a variable named `num1` the value of `5`.

**Student Code:**

{% code title="example.py" %}

```python
num1 = 5
```

{% endcode %}

**Grading Tests:**

```python
import unittest

class CodingRoomsUnitTests(unittest.TestCase):

    def test_default_case(self):
        import example
        self.assertTrue(example.num1 == 5)

if __name__ == '__main__':
    unittest.main()
```

## Number of items in a list

You can do anything you need to with a student's variable value.  For example, we can see if a student created a list with at least 3 items using the `len()` function.&#x20;

**Student Code:**

{% code title="example.py" %}

```python
my_list = ["first thing", "second thing", "third thing"]
```

{% endcode %}

**Grading Tests:**

```python
import unittest

class CodingRoomsUnitTests(unittest.TestCase):

    def test_default_case(self):
        import example
        self.assertTrue( len(example.my_list) >= 3 )

if __name__ == '__main__':
    unittest.main()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://auto-grade.joemazzone.net/python/check-variable-values.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
