Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alexandre CLENET
IUT
Commits
954339e5
Commit
954339e5
authored
May 02, 2022
by
E214194U
Browse files
maj
parent
6b2cfbce
Changes
2
Hide whitespace changes
Inline
Side-by-side
SAE/Touriste/BD/Projet_SAE.odt
0 → 100644
View file @
954339e5
File added
Stat/TP3/Exercice3_Substitution/s.py
View file @
954339e5
...
...
@@ -61,17 +61,18 @@ with open("texte_chiffre_substitution.txt", "r",encoding="UTF-8") as txt:
ret
=
lignes
new
=
chiffre
(
lignes
,
key
)
for
i
in
range
(
0
,
1000000
):
key
=
crypt
(
string
.
ascii_uppercase
)
#print(oldkey)
if
key
not
in
oldkey
:
oldkey
+=
key
new
=
chiffre
(
lignes
,
key
)
#print("new",logscore(new))
#print("ret",logscore(ret))
if
logscore
(
ret
)
>
logscore
(
new
):
ls
=
logscore
(
new
)
ret
=
new
#print("best ls",ls)
for
i
in
range
(
0
,
3
):
print
(
oldkey
)
while
key
in
oldkey
:
key
=
crypt
(
string
.
ascii_uppercase
)
oldkey
.
append
(
key
)
new
=
chiffre
(
lignes
,
key
)
#print("new",logscore(new))
#print("ret",logscore(ret))
if
logscore
(
ret
)
>
logscore
(
new
):
ls
=
logscore
(
new
)
ret
=
new
#print("best ls",ls)
print
(
"ret"
,
ret
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment