Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Koffi Gantchou
AP
Commits
87bce132
Commit
87bce132
authored
6 months ago
by
Koffi Gantchou
Browse files
Options
Downloads
Patches
Plain Diff
Replace tp1.py
parent
1205ca0b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tp1.py
+163
-130
163 additions, 130 deletions
tp1.py
with
163 additions
and
130 deletions
tp1.py
+
163
−
130
View file @
87bce132
...
@@ -114,15 +114,48 @@ def sont_anagrammes3(s1:str,s2:str)->bool:
...
@@ -114,15 +114,48 @@ def sont_anagrammes3(s1:str,s2:str)->bool:
$$$ sont_anagrammes3(
'
orange
'
,
'
organe
'
)
$$$ sont_anagrammes3(
'
orange
'
,
'
organe
'
)
True
True
$$$ sont_anagrammes3(
'
orange
'
,
'
Organe
'
)
$$$ sont_anagrammes3(
'
orange
'
,
'
Organe
'
)
True
False
$$$ sont_anagrammes3(
'
hezf
'
,
'
ehzu
'
)
$$$ sont_anagrammes3(
'
hezf
'
,
'
ehzu
'
)
False
False
"""
"""
for
elt
in
set
(
s1
):
for
elt
in
s1
:
if
s1
.
count
(
elt
)
==
s2
.
count
(
elt
):
if
s1
.
count
(
elt
)
!=
s2
.
count
(
elt
):
return
True
return
False
return
False
return
True
EQUIV_NON_ACCENTUE
=
{
'
é
'
:
'
e
'
,
'
ê
'
:
'
e
'
,
'
è
'
:
'
e
'
,
'
à
'
:
'
a
'
,
'
û
'
:
'
u
'
,
'
â
'
:
'
a
'
,
'
ï
'
:
'
i
'
}
def
bas_casse_sans_accent
(
chaine
:
str
)
->
str
:
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$ bas_casse_sans_accent(
'
Orangé
'
)
'
orange
'
$$$ bas_casse_sans_accent(
'
ghsêéè
'
)
'
ghseee
'
"""
res
=
''
for
elt
in
chaine
:
for
accentue
in
EQUIV_NON_ACCENTUE
:
if
elt
==
accentue
:
elt
=
EQUIV_NON_ACCENTUE
[
accentue
]
res
+=
elt
return
res
.
lower
()
def
sont_anagrammes4
(
s1
:
str
,
s2
:
str
)
->
bool
:
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$ sont_anagrammes4(
'
Orangé
'
,
'
organE
'
)
True
"""
a
=
bas_casse_sans_accent
(
s1
)
b
=
bas_casse_sans_accent
(
s2
)
if
sort
(
a
)
!=
sort
(
b
):
return
False
return
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment