Question: I am kind of new to python and its also my first time asking here so sorry in advance for any mistakes

I was working on a AI tic tac toe bot and while testing it I found that many a times the output was coming as none instead of the output that's mentioned in the return

TL;DR: return is giving none instead of output

```
(https://pastebin.com/kR2Mk2GA)

```

Answer: 
Change line 11 to read:

```
 read_cols: Optional[List[str]] = get_relevant_params()

```

Your problem is that mypy identified the type of the variable `read_cols` automatically as a List[str] because that's the return type of `get_relevant_params`. Then when you try to assign None to it, it says "incompatible type". If you specify on variable creation that you want it to be optional, everything works.

---

Maybe a cleaner solution is to avoid using a return variable.

```
    if config_path:
        return get_relevant_params()
    else:
        return None

```

This way, there's never any confusion about the type of `config_path`.
You didn't annotate `read_cols`, so mypy has to [infer a type](https://mypy.readthedocs.io/en/stable/type_inference_and_annotations.html) for it based on the first assignment to `read_cols`. The first assignment assigns a value of type `List[str]`, so mypy decides that's `read_cols`'s type, and `None` is not a valid value of that type.

If you want a different type, annotate your variables:

```
read_cols: Optional[List[str]]

```