Einzelfunktionenexperimentierverzeichnis in git integriert
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
abcgross = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
abcklein = "abcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
txt = input("Bitte zu kodierenden Text eingeben:")
|
||||
r = 0
|
||||
while r > 26 or r < 1:
|
||||
r = int(input("Um wieviele Stellen soll verschoben werden?(1-26) "))
|
||||
atxt = ""
|
||||
warn = 0
|
||||
warntxt = ""
|
||||
for i in txt:
|
||||
if i == " ":
|
||||
atxt = atxt + " "
|
||||
continue
|
||||
if i.upper() not in abcgross:
|
||||
atxt = atxt + i # nicht codierbare Zeichen direkt zur Ausgabe bitte!
|
||||
warn = warn + 1
|
||||
warntxt = warntxt + i + ","
|
||||
continue
|
||||
if i == i.upper():
|
||||
abc = abcgross
|
||||
if i == i.lower():
|
||||
abc = abcklein
|
||||
abcl = len(abc)
|
||||
for j in range(abcl):
|
||||
if i == abc[j]:
|
||||
if j + r >= abcl:
|
||||
atxt = atxt + abc[j + r - abcl]
|
||||
else:
|
||||
atxt = atxt + abc[j + r]
|
||||
print("Codierter Text:", atxt)
|
||||
if warn > 0:
|
||||
print("Achtung! folgende im Text enthaltenen Zeichen wurden nicht kodiert:", warntxt[:-1])
|
||||
@@ -0,0 +1,31 @@
|
||||
abc = ["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"]
|
||||
letterGoodness = [0.0817, 0.0149, 0.0278, 0.0425, 0.127, 0.0223, 0.0202, 0.0609, 0.0697, 0.0015, 0.0077, 0.0402, 0.0241,
|
||||
0.0675, 0.0751, 0.0193, 0.0009, 0.0599, 0.0633, 0.0906, 0.0276, 0.0098, 0.0236, 0.0015, 0.0197,
|
||||
0.0007]
|
||||
|
||||
txt = input("bitte Text:")
|
||||
ausgabe = ""
|
||||
ausgabeg = 0
|
||||
ausgaber = 0
|
||||
for r in range(1, 27):
|
||||
atxt = ""
|
||||
atxtg = 0
|
||||
for i in txt.upper():
|
||||
if i == " ":
|
||||
atxt = atxt + " "
|
||||
continue
|
||||
abcl = len(abc)
|
||||
for j in range(abcl):
|
||||
if i == abc[j]:
|
||||
if j + r >= abcl:
|
||||
atxt = atxt + abc[j + r - abcl]
|
||||
atxtg = atxtg + letterGoodness[j + r - abcl]
|
||||
else:
|
||||
atxt = atxt + abc[j + r]
|
||||
atxtg = atxtg + letterGoodness[j + r]
|
||||
if atxtg > ausgabeg:
|
||||
ausgabe = atxt
|
||||
ausgabeg = atxtg
|
||||
ausgaber = r
|
||||
print("Der dekodierte Text laut wahrscheinlich: ", ausgabe)
|
||||
Reference in New Issue
Block a user