This commit is contained in:
2024-01-24 11:27:32 +01:00
parent 45519a1e0a
commit a5d132e1cd
15 changed files with 163 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

12
.idea/A2.iml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
</module>

7
.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (DS_EST_Partiel_S3)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/A2.iml" filepath="$PROJECT_DIR$/.idea/A2.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

8
TP1/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

10
TP1/.idea/TP1.iml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

7
TP1/.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
TP1/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (TP1)" project-jdk-type="Python SDK" />
</project>

8
TP1/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/TP1.iml" filepath="$PROJECT_DIR$/.idea/TP1.iml" />
</modules>
</component>
</project>

6
TP1/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

63
TP1/tp1.py Normal file
View File

@@ -0,0 +1,63 @@
def celsius_fahrenheit(celcius):
return celcius * 9 / 5 + 32
def mention(note):
if note < 0:
return "Note hors échelle"
if note < 10:
return "Insuffisant"
elif note < 12:
return "Passable"
elif note < 14:
return "Assez bien"
elif note < 16:
return "Bien"
elif note < 18:
return "Très bien"
elif note < 20:
return "Note hors échelle"
else:
return "Note hors échelle"
def nombres_pairs(n):
return [i for i in range(n) if i % 2 == 0]
def remplacer(texte, caractere, nouveau_caractere):
return "".join([nouveau_caractere if c == caractere else c for c in texte])
def est_palindrome(texte):
return texte == texte[::-1]
def triplets_pythagoriciens(n):
return [(a, b, c) for a in range(1, n) for b in range(a, n) for c in range(b, n) if a ** 2 + b ** 2 == c ** 2]
def diviseurs(n):
return [i for i in range(1, n + 1) if n % i == 0]
def est_parfait(n):
return sum(diviseurs(n)) == n * 2
def occurrences_lettres(mot):
return {c: mot.count(c) for c in mot}
points_lettres = {
1 : ["E", "A", "I", "N", "O", "R", "S", "T", "U", "L"],
2 : ["D", "M", "G"],
3 : ["B", "C", "P"],
4 : ["F", "H", "V"],
8 : ["J", "Q"],
10 : ["K", "W", "X", "Y", "Z"]
}
def calculer_score(mot, points_lettres):
return sum([points for points, lettres in points_lettres.items() for lettre in mot.upper() if lettre in lettres])