Skip to content

Instantly share code, notes, and snippets.

@matthewmpalen
matthewmpalen / caesar.py
Created August 15, 2018 21:23
Caesar Cipher in Python
import random
import string
def create_translation_table(shift):
lower_alpha = string.ascii_lowercase
upper_alpha = string.ascii_uppercase
shifted_lower = lower_alpha[shift:] + lower_alpha[:shift]
shifted_upper = upper_alpha[shift:] + upper_alpha[:shift]
import itertools
def check_permutation(cards):
# No repeated elements
result = itertools.permutations(cards, 5)
for r in result:
yield r
def check_combination(cards):
result = itertools.combinations(cards, 5)