0

I want to take the first item from the list and make it a variable ad assign it with a randomly generated number 1-26

using python 3.10

I have gotten the code to be

def code():
    bank= ['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']

    for i in range(len(bank)):
        var = bank[0].astype()

and I am not sure how best to proceed though the answer is probably easy
want it to output something like a= 4 b=23 c=12 etc.etc

  • Please provide the expected output. Most pythonic option: `{k: random.randint(1,26) for k in bank}` – mozway Dec 20 '22 at 22:31

0 Answers0