Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
goelp14
GitHub Repository: goelp14/easyctf-iv-problems
Path: blob/master/prog_caesar/generator.py
650 views
1
from random import randint as ri
2
from random import choice as rc
3
c = int(input())
4
5
alp = list('abcdefghijklmnopqrstuvwxyz')
6
sts = ["i love easyctf", "mikel pls", "aaaaaaaaaaaaaaaaaa", "abcdefghijklmnopqrstuvwxyz", "michael", "summer camp", "a longer string with plenty of words and phrases", "what would an edge case even look like for this problem lol"]
7
8
def shift(s, b):
9
o = ''
10
for i in s:
11
if i in alp:
12
i = alp[(alp.index(i) + b) % 26]
13
o += i
14
return o
15
16
def gc(s, n):
17
return "{}\n{}\n".format(n, shift(s, n))
18
19
if c == 1:
20
print(gc(sts[0], 1))
21
elif c == 2:
22
print(gc(sts[1], 2))
23
elif c == 3:
24
print(gc(sts[2], 3))
25
else:
26
print(gc(rc(sts), c))
27