Einzelfunktionenexperimentierverzeichnis in git integriert
This commit is contained in:
@@ -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