> For the complete documentation index, see [llms.txt](https://yo-sarawut.gitbook.io/snippet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yo-sarawut.gitbook.io/snippet/python/dictionary/convert-two-lists.md).

# Convert Two Lists

## Convert Two Lists Into a Dictionary

### Using zip and dict methods

```python
index = [1, 2, 3]
languages = ['python', 'c', 'c++']

dictionary = dict(zip(index, languages))
print(dictionary)
```

**Output**

```
{1: 'python', 2: 'c', 3: 'c++'}
```

### Using list comprehension

```python
index = [1, 2, 3]
languages = ['python', 'c', 'c++']

dictionary = {k: v for k, v in zip(index, languages)}
print(dictionary)
```

**Output**

```
{1: 'python', 2: 'c', 3: 'c++'}
```

Reference : <https://www.programiz.com/python-programming/examples/list-to-dictionary>
