0

I currently have two lists of Variables. The first list is just the basic alphabet (I've named it the alpha list) and the second list is a shuffled version of that alphabet (I've named it the beta list). I would like to insert the Alpha list in a set of keys in a dictionary and the Beta list as a set of the values.

So far previous attempts on what I could find did not work for this situation


import random

incoding_cipher= {} #creating empty dictionaries 

decoding_cipher= {}

alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

beta= alpha[:]
random.shuffle(beta)
Cazards
  • 25
  • 3

1 Answers1

0

zip is what you need. Try

dict(zip(alpha, beta))
Ursus
  • 29,643
  • 3
  • 33
  • 50