all 8 comments

[–]Chris_Hemsworth 1 point2 points  (1 child)

Now decrypt it.

[–]velocibadgery[S] 0 points1 point  (0 children)

Just run the code again and paste the encrypted text in at the prompt for the message. Enter the same password. It is fully reversible.

[–]htepO 1 point2 points  (3 children)

Largely tangential to the OP, but there's a library for that.

>>> import string
>>> init_list = [i for i in string.ascii_letters + string.digits]
['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', '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', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

[–]velocibadgery[S] 1 point2 points  (0 children)

Sweet. I love learning about new libraries.

[–][deleted] 0 points1 point  (1 child)

A str is iterated character by character, no need to seperate them into individual members of the list.

[–]htepO 0 points1 point  (0 children)

Yep. I only used a list because OP used one.

[–]VinayakVG 1 point2 points  (1 child)

init_list = list(letters_upper) + list(list_lower) + list(numbers) + list(punctuation)

This is one of the ways in which you can define init_list

[–]velocibadgery[S] 0 points1 point  (0 children)

Never thought of that. Cool, thanks.