mardi 24 novembre 2020

Get pattern from list in python

I've got this list:

['i', 'like', 'dog', 'with', 'big', 'eye']

i want to print it out like:

i
i like
i like dog
i like dog with big eye

More difficult? How can I create a dict like:

{'i':'like', 'i like':'dog', 'i like dog':'with', 'i like dog with':'big', 'i like dog with big':'eye}

Aucun commentaire:

Enregistrer un commentaire