mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-07 10:50:36 +00:00
Add university content
This commit is contained in:
154
high-school/Dijkstra/algo.py
Normal file
154
high-school/Dijkstra/algo.py
Normal file
@@ -0,0 +1,154 @@
|
||||
def dijkstra(graph: dict, start: any) -> tuple:
|
||||
"""
|
||||
L'algorithme de Dijkstra pour trouver les plus courts chemins depuis un sommet de départ.
|
||||
|
||||
Args:
|
||||
graph (dict): Le graphe à parcourir sous forme de dictionnaire, où les clés sont les sommets
|
||||
et les valeurs sont des listes de tuples (voisin, poids).
|
||||
start (any): Le sommet de départ.
|
||||
|
||||
Returns:
|
||||
tuple: Un tuple contenant deux dictionnaires :
|
||||
- Le premier associe à chaque sommet la distance minimale depuis le sommet de départ.
|
||||
- Le second associe à chaque sommet (sauf le départ) son prédécesseur sur le chemin le plus court.
|
||||
|
||||
Exemples:
|
||||
>>> graph = {
|
||||
... 'A': [('B', 4), ('C', 2)],
|
||||
... 'B': [('C', 5), ('D', 10)],
|
||||
... 'C': [('D', 3), ('E', 8)],
|
||||
... 'D': [('E', 4), ('F', 11)],
|
||||
... 'E': [('G', 6)],
|
||||
... 'F': [('G', 2)],
|
||||
... 'G': []
|
||||
... }
|
||||
>>> distances, predecesseur = dijkstra(graph, 'A')
|
||||
>>> distances['A']
|
||||
0
|
||||
>>> distances['B']
|
||||
4
|
||||
>>> distances['C']
|
||||
2
|
||||
>>> distances['D']
|
||||
5
|
||||
>>> distances['E']
|
||||
9
|
||||
>>> distances['F']
|
||||
16
|
||||
>>> distances['G']
|
||||
15
|
||||
>>> predecesseur['B']
|
||||
'A'
|
||||
>>> predecesseur['C']
|
||||
'A'
|
||||
>>> predecesseur['D']
|
||||
'C'
|
||||
>>> predecesseur['E']
|
||||
'D'
|
||||
>>> predecesseur['F']
|
||||
'D'
|
||||
>>> predecesseur['G']
|
||||
'E'
|
||||
"""
|
||||
distances, predecesseur, unvisited = {}, {}, {}
|
||||
for sommet in graph:
|
||||
distances[sommet] = float("inf")
|
||||
unvisited[sommet] = distances[sommet]
|
||||
distances[start] = 0
|
||||
while unvisited:
|
||||
current = min(unvisited, key=unvisited.get)
|
||||
del unvisited[current]
|
||||
for voisin, poid in graph[current]:
|
||||
new_distance = distances[current] + poid
|
||||
if new_distance < distances[voisin]:
|
||||
distances[voisin] = new_distance
|
||||
predecesseur[voisin] = current
|
||||
if voisin in unvisited:
|
||||
unvisited[voisin] = new_distance
|
||||
return distances, predecesseur
|
||||
|
||||
|
||||
def reconstruire_chemin(predecesseur: dict, start: any, end: any) -> list:
|
||||
"""reconstruit le chemin grace au predecesseur
|
||||
|
||||
Args:
|
||||
predecesseur (dict): les predecesseurs
|
||||
start (any): le debut
|
||||
end (any): la fin
|
||||
|
||||
Returns:
|
||||
list: renvoie une liste contenant le chemin le plus court (si aucun trouver alors renvoie liste vide)
|
||||
Examples:
|
||||
>>> pred = {'B': 'A', 'C': 'A', 'D': 'C', 'E': 'D', 'F': 'D', 'G': 'E'}
|
||||
>>> reconstruire_chemin(pred, 'A', 'F')
|
||||
['A', 'C', 'D', 'F']
|
||||
>>> reconstruire_chemin(pred, 'A', 'G')
|
||||
['A', 'C', 'D', 'E', 'G']
|
||||
"""
|
||||
chemin = [end]
|
||||
current = end
|
||||
while current != start:
|
||||
if current not in predecesseur:
|
||||
return []
|
||||
current = predecesseur[current]
|
||||
chemin.append(current)
|
||||
chemin.reverse()
|
||||
return chemin
|
||||
|
||||
|
||||
def solutions_dijkstra(graph: dict, start: any) -> dict:
|
||||
"""elle renvoie le dictionnaire des noeud et distances grace au chemin
|
||||
|
||||
Args:
|
||||
graph (dict): le graphe
|
||||
start (any): le debut
|
||||
|
||||
Returns:
|
||||
dict: contenant les noeuds et leurs distances
|
||||
Exemples:
|
||||
>>> graph = {
|
||||
... 'A': [('B', 4), ('C', 2)],
|
||||
... 'B': [('C', 5), ('D', 10)],
|
||||
... 'C': [('D', 3), ('E', 8)],
|
||||
... 'D': [('E', 4), ('F', 11)],
|
||||
... 'E': [('G', 6)],
|
||||
... 'F': [('G', 2)],
|
||||
... 'G': []
|
||||
... }
|
||||
>>> sol = solutions_dijkstra(graph, 'A')
|
||||
>>> sol['F']
|
||||
{'distance': 16, 'chemin': ['A', 'C', 'D', 'F']}
|
||||
>>> sol['G']
|
||||
{'distance': 15, 'chemin': ['A', 'C', 'D', 'E', 'G']}
|
||||
"""
|
||||
distances, predecesseur = dijkstra(graph, start)
|
||||
solutions = {}
|
||||
for sommet in graph:
|
||||
if sommet == start:
|
||||
chemin = [start]
|
||||
else:
|
||||
chemin = reconstruire_chemin(predecesseur, start, sommet)
|
||||
if not chemin:
|
||||
chemin = None
|
||||
solutions[sommet] = {"distance": distances[sommet], "chemin": chemin}
|
||||
return solutions
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod(verbose=True)
|
||||
graph = {
|
||||
"A": [("B", 4), ("C", 2)],
|
||||
"B": [("C", 5), ("D", 10)],
|
||||
"C": [("D", 3), ("E", 8)],
|
||||
"D": [("E", 4), ("F", 11)],
|
||||
"E": [("G", 6)],
|
||||
"F": [("G", 2)],
|
||||
"G": [],
|
||||
}
|
||||
solution = solutions_dijkstra(graph, "A")
|
||||
for sommet, info in solution.items():
|
||||
print(
|
||||
f"sommet: {sommet} ----- Distance: {info['distance']} ------- chemin: {info['chemin']}"
|
||||
)
|
||||
46
high-school/Dijkstra/fonctions.md
Normal file
46
high-school/Dijkstra/fonctions.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Dijkstra
|
||||
## Fonctions
|
||||
### `dijkstra(graph: dict, start: any) -> tuple`
|
||||
- **Paramètres :**
|
||||
- `graph` : Dictionnaire représentant le graphe. Chaque clé est un noeud et sa valeur est une liste de tuples `(voisin, poids)`.
|
||||
- `start` : Le noeud de départ.
|
||||
- **Retourne :**
|
||||
- Un tuple contenant :
|
||||
- `distances` : Un dictionnaire associant à chaque noeud la distance minimale depuis `start`.
|
||||
- `predecesseur` : Un dictionnaire associant à chaque noeud son prédécesseur dans le chemin le plus court.
|
||||
|
||||
---
|
||||
### `reconstruct_chemin(predecesseur: dict, start: any, end: any) -> list`
|
||||
|
||||
- **Paramètres :**
|
||||
- `predecesseur` : Dictionnaire des prédécesseurs.
|
||||
- `start` : Le noeud de départ.
|
||||
- `end` : Le noeud d'arrivée.
|
||||
- **Retourne :**
|
||||
- Une liste représentant le chemin le plus court de `start` à `end`.
|
||||
Si aucun chemin n'est trouvé, la fonction renvoie une liste vide.
|
||||
|
||||
---
|
||||
### `solutions_dijkstra(graph: dict, start: any) -> dict`
|
||||
|
||||
- **Paramètres :**
|
||||
- `graph` : Dictionnaire représentant le graphe.
|
||||
- `start` : Le noeud de départ.
|
||||
- **Retourne :**
|
||||
- Un dictionnaire où chaque clé est un noeud du graphe et la valeur associée est un sous-dictionnaire contenant :
|
||||
- `"distance"` : La distance minimale depuis `start`.
|
||||
- `"chemin"` : Le chemin le plus court sous forme de liste de noeuds None si pas trouver.
|
||||
|
||||
---
|
||||
## Utilisation
|
||||
Le graphe doit être défini sous forme de dictionnaire. Exemple :
|
||||
```python
|
||||
graph = {
|
||||
'A': [('B', 4), ('C', 2)],
|
||||
'B': [('C', 5), ('D', 10)],
|
||||
'C': [('D', 3), ('E', 8)],
|
||||
'D': [('E', 4), ('F', 11)],
|
||||
'E': [('G', 6)],
|
||||
'F': [('G', 2)],
|
||||
'G': []
|
||||
}
|
||||
373
high-school/LICENSE
Normal file
373
high-school/LICENSE
Normal file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
BIN
high-school/Partie2/Eleve/._livres.sql
Normal file
BIN
high-school/Partie2/Eleve/._livres.sql
Normal file
Binary file not shown.
BIN
high-school/Partie2/Eleve/._p_app_web_python_sqlite.pdf
Normal file
BIN
high-school/Partie2/Eleve/._p_app_web_python_sqlite.pdf
Normal file
Binary file not shown.
1
high-school/Partie2/Eleve/Projet/__init__.py
Normal file
1
high-school/Partie2/Eleve/Projet/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .control import app
|
||||
8
high-school/Partie2/Eleve/Projet/control.py
Normal file
8
high-school/Partie2/Eleve/Projet/control.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from flask import Flask, render_template
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template("index.html")
|
||||
13
high-school/Partie2/Eleve/Projet/index.html
Normal file
13
high-school/Partie2/Eleve/Projet/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='CSS/style.css')}}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Bonjour</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
13
high-school/Partie2/Eleve/Projet/templates/index.html
Normal file
13
high-school/Partie2/Eleve/Projet/templates/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='CSS/style.css')}}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Bonjour</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
high-school/Partie2/Eleve/livres.db
Normal file
BIN
high-school/Partie2/Eleve/livres.db
Normal file
Binary file not shown.
BIN
high-school/Partie2/Eleve/livres.db-journal
Normal file
BIN
high-school/Partie2/Eleve/livres.db-journal
Normal file
Binary file not shown.
480
high-school/Partie2/Eleve/livres.sql
Normal file
480
high-school/Partie2/Eleve/livres.sql
Normal file
@@ -0,0 +1,480 @@
|
||||
BEGIN TRANSACTION;
|
||||
DROP TABLE IF EXISTS "usagers";
|
||||
CREATE TABLE IF NOT EXISTS "usagers" (
|
||||
"nom" VARCHAR(90),
|
||||
"prenom" VARCHAR(90),
|
||||
"adresse" VARCHAR(90),
|
||||
"cp" VARCHAR(90),
|
||||
"ville" VARCHAR(90),
|
||||
"email" VARCHAR(90),
|
||||
"code_barre" CHAR(10),
|
||||
CONSTRAINT "PK_usagers" PRIMARY KEY("code_barre")
|
||||
);
|
||||
DROP TABLE IF EXISTS "livre";
|
||||
CREATE TABLE IF NOT EXISTS "livre" (
|
||||
"titre" VARCHAR(300) NOT NULL,
|
||||
"editeur" VARCHAR(90) NOT NULL,
|
||||
"annee" INT NOT NULL,
|
||||
"isbn" CHAR(14),
|
||||
PRIMARY KEY("isbn")
|
||||
);
|
||||
DROP TABLE IF EXISTS "auteur";
|
||||
CREATE TABLE IF NOT EXISTS "auteur" (
|
||||
"a_id" INT,
|
||||
"nom" VARCHAR(90) NOT NULL,
|
||||
"prenom" VARCHAR(90) NOT NULL,
|
||||
PRIMARY KEY("a_id")
|
||||
);
|
||||
DROP TABLE IF EXISTS "auteur_de";
|
||||
CREATE TABLE IF NOT EXISTS "auteur_de" (
|
||||
"a_id" INT,
|
||||
"isbn" CHAR(14),
|
||||
FOREIGN KEY("a_id") REFERENCES "Auteur"("a_id"),
|
||||
FOREIGN KEY("isbn") REFERENCES "livre"("isbn"),
|
||||
PRIMARY KEY("a_id","isbn")
|
||||
);
|
||||
DROP TABLE IF EXISTS "emprunts";
|
||||
CREATE TABLE IF NOT EXISTS "emprunts" (
|
||||
"code_barre" CHAR(10),
|
||||
"isbn" VARCHAR(15),
|
||||
"date_retour" DATE,
|
||||
CONSTRAINT "FK_emprunts_usagers" FOREIGN KEY("code_barre") REFERENCES "usagers"("code_barre"),
|
||||
CONSTRAINT "FK_emprunts_livre" FOREIGN KEY("isbn") REFERENCES "livre"("isbn"),
|
||||
CONSTRAINT "PK_emprunts" PRIMARY KEY("code_barre","isbn","date_retour")
|
||||
);
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('MICHEL','VALÉRIE','104, Rue du Stade','75013','Paris','vmichel5@monmail.com','199614051174633');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('DURAND','JULIEN','183, Rue de la Gare','75019','Paris','jdurand9@email.fr','782124241492509');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('MOREAU','ALAIN','48, Rue du Château','75005','Paris','amoreau1@abc.de','421921003090881');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('DUBOIS','PHILIPPE','35, Rue du Moulin','75014','Paris','pdubois5@chezmoi.net','137332830764072');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('ROBERT','PASCAL','95, Rue de la Gare','75005','Paris','probert9@monmail.com','533299198788609');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('FOURNIER','DAVID','157, Rue de la Fontaine','75007','Paris','dfournier4@abc.de','612978231522917');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('LAURENT','FRANÇOISE','90, Rue Principale','75005','Paris','flaurent3@monmail.com','917547585216771');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('SIMON','SANDRINE','45, Rue du Château','75020','Paris','ssimon2@abc.de','654834075188732');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('PETIT','SÉBASTIEN','5, Rue du Stade','75012','Paris','spetit4@email.fr','934701281931582');
|
||||
INSERT INTO "usagers" ("nom","prenom","adresse","cp","ville","email","code_barre") VALUES ('BERNARD','STÉPHANE','131, Place de la Mairie','75015','Paris','sbernard2@chezmoi.net','035184062854281');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Aventures de Huckleberry Finn','Flammarion',2020,'978-2081509511');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Fondation et Empire','Editions Denoël',1999,'978-2207249123');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Akira','Glénat',2000,'978-2723428262');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Robots','Editions Milan',2017,'978-2745989857');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix chez les Pictes','Editions Albert René',2013,'978-2864972662');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Monades urbaines','Robert Laffont',2016,'978-2221197691');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Voyages de Gulliver','Primento',2015,'978-2335008586');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Lolita','Penguin UK',2012,'978-0141391601');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Nuit des temps','Presses de la Cité',2014,'978-2258116429');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Ravage','Editions Gallimard',2014,'978-2072534911');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Lauriers de César','Educa Books',2008,'978-2012101500');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Niourk','French Pulp éditions',2018,'979-1025100639');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Meilleur des mondes','Plon',2013,'978-2259221702');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Berlin Alexanderplatz','Editions Gallimard',1933,'978-2070219292');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Fahrenheit 451','Simon and Schuster',2011,'978-1439142677');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Mort d''Ivan Ilitch','Flammarion',2015,'978-2081364509');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Croisière sans escale','Editions Denoël',1990,'978-2207500293');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Vieil Homme et la Mer','Editions Gallimard',2018,'978-2072762093');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Mrs Dalloway','Flammarion',2015,'978-2081358881');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Idiot','Les Editions de Londres',2019,'978-1911572909');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Carnet d''or','Le Livre de poche',1980,'978-2253025320');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Grandes Espérances','BoD - Books on Demand',2019,'978-2322185801');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix et Cléopâtre','Dargaud',1999,'978-2012100060');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Madame Bovary','UPblisher',2016,'978-2759902293');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Frères Karamazov','Les éditions Pulsio',2016,'978-2371131118');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Moby Dick','Campfire Graphic Novels',2010,'978-8190732673');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Demain les chiens','J''ai Lu',2015,'978-2290112168');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Tour de Gaule d''Astérix','Educa Books',2007,'978-2012101685');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('1984','Houghton Mifflin Harcourt',1983,'978-0547249643');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Don Quichotte','Les éditions Pulsio',2016,'978-2371130418');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Château de Lord Valentin','Robert Laffont',2017,'978-2221216361');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Père Goriot','Primento',2012,'978-2806231697');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Procès','Flammarion',2014,'978-2081351981');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Homme qui rétrécit','Editions Gallimard',2017,'978-2072457340');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Chroniques martiennes','Editions Gallimard',2016,'978-2072455162');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Roi Lear','Éditions Actes Sud',2015,'978-2330052768');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Cadeau de César','Educa Books',2005,'978-2012101531');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Planète des singes','Julliard',2011,'978-2260019183');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Orgueil et Préjugés','Fleurus',2015,'978-2215130475');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Une maison de poupée','Éditions Actes Sud',2016,'978-2330068349');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Vermilion Sands','Carroll & Graf Pub',1988,'978-0881844221');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Grande Traversée','Seuil Jeunesse',2014,'979-1023500448');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Étranger','Editions Gallimard',2012,'978-2072376429');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Île des morts','POL Editeur',2010,'978-2846825573');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Par-delà le mur du sommeil','République des Lettres',2018,'978-2824904269');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Papyrus de César','Editions Albert René',2015,'978-2864972716');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Main de Zeï','Bragelonne Classic',2016,'978-2820511034');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Beloved','Christian Bourgois',2015,'978-2267028133');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Conscience de Zeno','République des Lettres',2015,'978-2824902371');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Delirium Circus','Bragelonne',2013,'978-2820508935');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Médée','Hatier',2013,'978-2218972324');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Nostromo','Oxford University Press',2009,'978-0199555918');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Au carrefour des étoiles','J''ai Lu',1997,'978-2277118473');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Vagabond','BnF collection ebooks',2016,'978-2346014453');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Buddenbrook','LGF/Le Livre de Poche',1993,'978-2253063193');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Métamorphoses','Le Livre de Poche',2011,'978-2253158677');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Jack Barron et l''Éternité','J''ai Lu',2016,'978-2290105504');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Hacker''s Delight','Addison-Wesley Professional',2003,'978-0201914658');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix et les Normands','Dargaud',2005,'978-2012101418');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Temps incertain','Robert Laffont',2011,'978-2221119709');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix en Corse','Dargaud',2005,'978-2012101524');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Fils de la Médina','Arles [France] : Actes sud',2003,'978-2742744824');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Grand secret','Presses de la Cité',2014,'978-2258116405');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Devin','Educa Books',2010,'978-2012101517');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Noir Dessein','Livre de poche',1998,'978-2253062820');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix légionnaire','Educa Books',2011,'978-2012101784');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Romancero gitano','Greenbooks editore',2020,'978-8832957402');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('The Practice of Programming','Addison-Wesley Professional',1999,'978-0201615869');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Crime et Châtiment','Editions Humanis',2012,'979-1021900486');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Promenade au phare','LGF/Le Livre de Poche',1983,'978-2253031536');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Homme sans qualités','Contemporary French Fiction',2011,'978-2757803691');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Bruit et la Fureur','Gallimard Education',1972,'978-2070361625');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Plus qu''humains','adsaa',1999,'000-0000000162');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Main gauche de la nuit','Robert Laffont',2012,'978-2221128121');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Mémoires d''Hadrien','Gallimard Education',1974,'978-2070369218');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Contes de l''absurde','Presses Pocket',1978,'978-2266006095');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix et la Transitalique','Editions Albert René',2017,'978-2864973270');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Odyssée d''Astérix','Educa Books',2008,'978-2864972051');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Singes du temps','Robert Laffont',2011,'978-2221119693');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Contes de Canterbury','Gallimard Education',2000,'978-2070406340');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Sécheresse','La Cheminante',2014,'978-2371270060');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('The Art of Computer Programming','Addison-Wesley Professional',1997,'978-0321635747');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Aveuglement','Contemporary French Fiction',2000,'978-2020403436');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Berceau du chat','Contemporary French Fiction',2010,'978-2757820919');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Anna Karénine','Bibliothèque russe et slave',2018,'978-2371240087');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Montagne magique','Fayard',2016,'978-2213703848');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Domaine des dieux','French & European Publications',1992,'978-0785909903');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Cent ans de solitude','Contemporary French Fiction',1995,'978-2020238113');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Gargantua et Pantagruel','Livre de Poche Jeunesse',2009,'978-2013230827');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Contes','J''ai Lu',2015,'978-2290117965');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Guerre et Paix','Archipoche',2016,'978-2352879183');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Énéide','Belles Lettres',1993,'978-2251013039');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Seconde Fondation','adsaa',1979,'000-0000000097');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Jeux de l''esprit','FeniXX',1971,'978-2402281775');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Middlemarch','Wordsworth Editions',1994,'978-1853262371');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Œdipe roi','J''ai Lu',2013,'978-2290080207');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Amour aux temps du choléra','Grasset',2009,'978-2246819554');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Fictions','Gallimard Education',1974,'978-2070366149');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix chez les Bretons','Dargaud',2002,'978-2012100084');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Château','Points',2011,'978-2757827413');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Voyageur imprudent','Editions Gallimard',2014,'978-2072535031');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Je suis une légende','Editions Gallimard',2013,'978-2072457388');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Maître du Haut Château','J''ai Lu',2017,'978-2290157268');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Âmes mortes','Bibliothèque russe et slave',2018,'978-2371240001');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Tambour','Contemporary French Fiction',1997,'978-2020314305');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Polymath','iMinds Pty Ltd',2014,'978-1921746864');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Seigneur de lumière','Editions Gallimard',2014,'978-2072487958');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Ulysse','Nathan',2012,'978-2092532195');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Pedro Páramo','New York : Grove Press',1959,'000-0000000069');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Ubik','Houghton Mifflin Harcourt',2012,'978-0547728247');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Algorithms','Addison-Wesley Professional',2011,'978-0132762564');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Fifi Brindacier','Hachette Romans',2013,'978-2011179043');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le monde s''effondre','Editions Présence Africaine',1972,'978-2708701915');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Naissance des dieux','Glénat BD',2017,'978-2331035531');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Hamlet','Primento',2012,'978-2806240187');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Enfants de minuit','Gallimard Education',2010,'978-2070402632');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Dune','Penguin',2003,'978-1101658055');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Couleur tombée du ciel','Tiers Livre Éditeur',2014,'978-2814510012');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Éducation sentimentale','FeniXX',1990,'978-2402282697');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Obélix et Compagnie','Educa Books',2008,'978-2012101555');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Journal d''un fou','Bibebook',2013,'978-2824709420');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Les Hauts de Hurlevent','Le Livre de Poche',2012,'978-2253174561');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La Plaie','FeniXX',1967,'978-2402255462');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Astérix chez les Belges','Dargaud',1979,'978-2012101562');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Le Rouge et le Noir','Les Éditions de l''Ebook malin',1971,'978-2367881171');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('À la recherche du temps perdu','Books LLC, Wiki Series',2010,'978-1153611725');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('La storia','Editions Gallimard',2004,'978-2070315017');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('L''Homme total','Presses Universitaires de France - PUF',2011,'978-2130592150');
|
||||
INSERT INTO "livre" ("titre","editeur","annee","isbn") VALUES ('Mon livre','Buisson',2022,'0-2022');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (0,'Twain','Mark');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (1,'Asimov','Isaac');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (2,'Ōtomo','Katsuhiro');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (3,'Martelle','Myriam');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (4,'Touache','Sébastien');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (5,'Goscinny','René');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (6,'Ferri','Jean-Yves');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (7,'Uderzo','Albert');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (8,'Conrad','Didier');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (9,'SILVERBERG','Robert');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (10,'Swift','Jonathan');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (11,'Ligaran,','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (12,'Nabokov','Vladimir');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (13,'BARJAVEL','René');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (14,'Barjavel','René');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (15,'Wul','Stefan');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (16,'HUXLEY','Aldous');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (17,'Döblin','Alfred');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (18,'Bradbury','Ray');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (19,'Tolstoï','Léon');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (20,'Aldiss','Brian Wilson');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (21,'Hemingway','Ernest');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (22,'Woolf','Virginia');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (23,'Fiodor','Dostoïevski');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (24,'Lessing','Doris');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (25,'Dickens','Charles');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (26,'Flaubert','Gustave');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (27,'Dostoïevski','Fiodor');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (28,'Melville','Herman');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (29,'Simak','Clifford D.');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (30,'Orwell','George');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (31,'Cervantes','Miguel de');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (32,'Balzac','Honoré de');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (33,'Kafka','Franz');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (34,'Matheson','Richard');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (35,'Py','Olivier');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (36,'Shakespeare','William');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (37,'BOULLE','Pierre');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (38,'Austen','Jane');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (39,'Ibsen','Henrik');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (40,'Ballard','J. G.');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (41,'Demois','Agathe');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (42,'Godeau','Vincent');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (43,'Camus','Albert');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (44,'Frémon','Jean');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (45,'Lovecraft','H. P.');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (46,'Camp','Lyon Sprague de');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (47,'Morrison','Toni');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (48,'Svevo','Italo');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (49,'Pelot','Pierre');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (50,'Corneille','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (51,'Faerber','Johan');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (52,'Conrad','Joseph');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (53,'Deutsch','Michel');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (54,'Maupassant','Guy de');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (55,'Mann','Thomas');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (56,'Ovide','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (57,'Spinrad','Norman');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (58,'Warren','Henry S.');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (59,'JEURY','Michel');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (60,'Goscinny','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (61,'Maḥfūẓ','Naǧīb');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (62,'Farmer','Philip José');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (63,'Lorca','Federico Garcia');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (64,'Kernighan','Brian W.');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (65,'Pike','Rob');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (66,'Dostoïevski','Fédor Mikhaïlovitch');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (67,'Musil','Robert');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (68,'Faulkner','William');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (69,'Fransa','France');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (70,'GUIN','Ursula LE');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (71,'Yourcenar','Marguerite');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (72,'Boulle','Pierre');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (73,'Gascony','Rene');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (74,'Chaucer','Geoffrey');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (75,'Chenet','Gérard');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (76,'Knuth','Donald E.');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (77,'Saramago','José');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (78,'Vonnegut','Kurt');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (79,'Goscinny','Rene');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (80,'Márquez','Gabriel García');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (81,'Rabelais','François');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (82,'Laporte','Michel');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (83,'Nadel','Olivier-Marc');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (84,'Grimm','Jacob');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (85,'Grimm','Wilhelm');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (86,'Vergilius','Publius Maro');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (87,'Virgile','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (88,'Eliot','George');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (89,'Sophocle','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (90,'Márquez','Gabriel Garcia');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (91,'Borges','Jorge Luis');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (92,'Dick','Philip K.');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (93,'Gogol','Nikolaï');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (94,'Grass','Günter');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (95,'iMinds','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (96,'Zelazny','Roger');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (97,'Montardre','Hélène');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (98,'Rulfo','Juan');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (99,'Sedgewick','Robert');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (100,'Wayne','Kevin');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (101,'Lindgren','Astrid');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (102,'Achebe','Chinua');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (103,'Bruneau','Clotilde');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (104,'D.','Dim');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (105,'Santagati','Federico');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (106,'Ferry','Luc');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (107,'Poli','Didier');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (108,'Rushdie','Salman');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (109,'Herbert','Frank');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (110,'Lovecraft','Howard Phillips');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (111,'Rincé','Dominique');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (112,'Gogol','Nikolai');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (113,'Brontë','Emily');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (114,'Fall','Malick');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (115,'Stendhal','');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (116,'Wikipedia','Source');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (117,'Morante','Elsa');
|
||||
INSERT INTO "auteur" ("a_id","nom","prenom") VALUES (118,'Karsenti','Bruno');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (0,'978-2081509511');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (1,'978-2207249123');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (2,'978-2723428262');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (3,'978-2745989857');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (4,'978-2745989857');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2864972662');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (6,'978-2864972662');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2864972662');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (8,'978-2864972662');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (9,'978-2221197691');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (10,'978-2335008586');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (11,'978-2335008586');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (12,'978-0141391601');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (13,'978-2258116429');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (14,'978-2072534911');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101500');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101500');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (15,'979-1025100639');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (16,'978-2259221702');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (17,'978-2070219292');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (18,'978-1439142677');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (19,'978-2081364509');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (20,'978-2207500293');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (21,'978-2072762093');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (22,'978-2081358881');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (23,'978-1911572909');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (24,'978-2253025320');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (25,'978-2322185801');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012100060');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012100060');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (26,'978-2759902293');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (27,'978-2371131118');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (28,'978-8190732673');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (29,'978-2290112168');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101685');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101685');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (30,'978-0547249643');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (31,'978-2371130418');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (9,'978-2221216361');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (32,'978-2806231697');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (33,'978-2081351981');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (34,'978-2072457340');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (18,'978-2072455162');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (35,'978-2330052768');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (36,'978-2330052768');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101531');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101531');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (37,'978-2260019183');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (38,'978-2215130475');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (39,'978-2330068349');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (40,'978-0881844221');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (41,'979-1023500448');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (42,'979-1023500448');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (43,'978-2072376429');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (44,'978-2846825573');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (45,'978-2824904269');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (6,'978-2864972716');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (46,'978-2820511034');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (47,'978-2267028133');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (48,'978-2824902371');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (49,'978-2820508935');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (50,'978-2218972324');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (51,'978-2218972324');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (52,'978-0199555918');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (29,'978-2277118473');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (53,'978-2277118473');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (54,'978-2346014453');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (55,'978-2253063193');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (56,'978-2253158677');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (57,'978-2290105504');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (58,'978-0201914658');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101418');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101418');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (59,'978-2221119709');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (60,'978-2012101524');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101524');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (61,'978-2742744824');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (13,'978-2258116405');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101517');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101517');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (62,'978-2253062820');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101784');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101784');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (63,'978-8832957402');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (64,'978-0201615869');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (65,'978-0201615869');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (66,'979-1021900486');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (22,'978-2253031536');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (67,'978-2757803691');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (68,'978-2070361625');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (69,'000-0000000162');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (70,'978-2221128121');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (71,'978-2070369218');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (72,'978-2266006095');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (6,'978-2864973270');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (73,'978-2864972051');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2864972051');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (59,'978-2221119693');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (74,'978-2070406340');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (75,'978-2371270060');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (76,'978-0321635747');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (77,'978-2020403436');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (78,'978-2757820919');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (19,'978-2371240087');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (55,'978-2213703848');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (79,'978-0785909903');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-0785909903');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (80,'978-2020238113');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (81,'978-2013230827');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (82,'978-2013230827');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (83,'978-2013230827');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (84,'978-2290117965');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (85,'978-2290117965');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (19,'978-2352879183');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (86,'978-2251013039');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (87,'978-2251013039');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (1,'000-0000000097');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (72,'978-2402281775');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (88,'978-1853262371');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (89,'978-2290080207');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (90,'978-2246819554');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (91,'978-2070366149');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012100084');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012100084');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (33,'978-2757827413');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (14,'978-2072535031');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (34,'978-2072457388');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (92,'978-2290157268');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (93,'978-2371240001');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (94,'978-2020314305');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (95,'978-1921746864');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (96,'978-2072487958');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (97,'978-2092532195');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (98,'000-0000000069');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (92,'978-0547728247');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (99,'978-0132762564');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (100,'978-0132762564');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (101,'978-2011179043');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (102,'978-2708701915');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (103,'978-2331035531');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (104,'978-2331035531');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (105,'978-2331035531');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (106,'978-2331035531');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (107,'978-2331035531');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (36,'978-2806240187');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (108,'978-2070402632');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (109,'978-1101658055');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (110,'978-2814510012');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (111,'978-2402282697');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101555');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101555');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (112,'978-2824709420');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (113,'978-2253174561');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (114,'978-2402255462');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (5,'978-2012101562');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (7,'978-2012101562');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (115,'978-2367881171');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (116,'978-1153611725');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (117,'978-2070315017');
|
||||
INSERT INTO "auteur_de" ("a_id","isbn") VALUES (118,'978-2130592150');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('421921003090881','978-2081358881','2020-04-28');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('421921003090881','978-2207249123','2020-04-28');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('421921003090881','978-2824709420','2020-04-28');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('137332830764072','978-2352879183','2020-02-20');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('137332830764072','978-2335008586','2020-02-20');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('137332830764072','978-2013230827','2020-02-20');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('533299198788609','978-2253174561','2020-02-28');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('533299198788609','978-2251013039','2020-02-28');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('917547585216771','978-2290105504','2020-04-07');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('654834075188732','978-2864973270','2020-02-17');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('654834075188732','978-2070406340','2020-02-17');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('654834075188732','978-2806231697','2020-02-17');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('934701281931582','978-2260019183','2020-01-01');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('934701281931582','978-2371240087','2020-01-01');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('035184062854281','978-2745989857','2020-02-18');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('035184062854281','978-2072762093','2020-02-18');
|
||||
INSERT INTO "emprunts" ("code_barre","isbn","date_retour") VALUES ('035184062854281','978-2742744824','2020-02-18');
|
||||
COMMIT;
|
||||
BIN
high-school/Partie2/Eleve/p_app_web_python_sqlite.pdf
Normal file
BIN
high-school/Partie2/Eleve/p_app_web_python_sqlite.pdf
Normal file
Binary file not shown.
5
high-school/Partie2/Eleve/run.py
Normal file
5
high-school/Partie2/Eleve/run.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from Projet import app
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
170
high-school/README.html
Normal file
170
high-school/README.html
Normal file
@@ -0,0 +1,170 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="ISO-8859-1">
|
||||
<title>Source file</title>
|
||||
<link rel="stylesheet" type="text/css" href="highlight.css">
|
||||
</head>
|
||||
<body class="hl">
|
||||
<pre class="hl">.
|
||||
├── algo2.md
|
||||
├── casse-brique
|
||||
│ ├── main.py
|
||||
│ └── pygame.py
|
||||
├── cesar
|
||||
│ ├── chiffrement.py
|
||||
│ ├── message2.txt
|
||||
│ └── message.txt
|
||||
├── crypto
|
||||
│ ├── algo.py
|
||||
│ └── message
|
||||
├── Dijkstra
|
||||
│ ├── algo.py
|
||||
│ └── fonctions.md
|
||||
├── ensembles_dynamiques
|
||||
│ └── TP
|
||||
│ ├── _collection_list.py
|
||||
│ ├── _collection.py
|
||||
│ ├── data
|
||||
│ │ └── Chartreuse.csv
|
||||
│ ├── main.py
|
||||
│ ├── _sommets_dict.py
|
||||
│ └── _sommets.py
|
||||
├── fibonacci
|
||||
│ ├── code1.py
|
||||
│ ├── complex.py
|
||||
│ └── fibobo
|
||||
│ ├── Cargo.lock
|
||||
│ ├── Cargo.toml
|
||||
│ └── src
|
||||
│ └── main.rs
|
||||
├── fichier.md
|
||||
├── file
|
||||
│ └── new
|
||||
│ └── fifo.py
|
||||
├── fonctions_tri
|
||||
│ └── partitionement.py
|
||||
├── get_bac_subject
|
||||
│ └── get_bac_subject
|
||||
│ ├── Cargo.lock
|
||||
│ ├── Cargo.toml
|
||||
│ ├── src
|
||||
│ │ └── main.rs
|
||||
│ └── url.txt
|
||||
├── graphes
|
||||
│ ├── DS_possible
|
||||
│ │ ├── main.py
|
||||
│ │ └── v
|
||||
│ ├── homework_wednesday.py
|
||||
│ ├── ht
|
||||
│ ├── leaudibidon
|
||||
│ │ ├── correction.py
|
||||
│ │ ├── main.py
|
||||
│ │ └── Water_jug.py
|
||||
│ ├── maze
|
||||
│ │ ├── fifo.py
|
||||
│ │ ├── lifo.py
|
||||
│ │ ├── main.py
|
||||
│ │ ├── maze_creator.py
|
||||
│ │ └── test.py
|
||||
│ ├── monday_homework.py
|
||||
│ └── why
|
||||
├── highlight.css
|
||||
├── LICENSE
|
||||
├── magic_square
|
||||
│ ├── magic_square.py
|
||||
│ ├── td_carre_magique.py
|
||||
│ └── TDliste2liste
|
||||
│ ├── exercice1.py
|
||||
│ ├── exercice2.py
|
||||
│ ├── exercice3.py
|
||||
│ ├── exercice4.py
|
||||
│ ├── exercice5.py
|
||||
│ └── exercice6.py
|
||||
├── Partie2
|
||||
│ └── Eleve
|
||||
│ ├── livres.db
|
||||
│ ├── livres.db-journal
|
||||
│ ├── livres.sql
|
||||
│ ├── p_app_web_python_sqlite.pdf
|
||||
│ ├── Projet
|
||||
│ │ ├── control.py
|
||||
│ │ ├── index.html
|
||||
│ │ ├── __init__.py
|
||||
│ │ └── templates
|
||||
│ │ └── index.html
|
||||
│ └── run.py
|
||||
├── partition_fusion
|
||||
│ ├── code2.py
|
||||
│ ├── code.py
|
||||
│ ├── liste.py
|
||||
│ └── partition_fusion.py
|
||||
├── perfect_number
|
||||
│ └── main.py
|
||||
├── prblm.txt
|
||||
├── prep
|
||||
├── preuve.md
|
||||
├── programmation_dynamique
|
||||
│ ├── bag
|
||||
│ │ └── main.py
|
||||
│ └── monnaie
|
||||
│ ├── piece1.py
|
||||
│ └── piece.py
|
||||
├── question_du_jour
|
||||
│ ├── 05-05-2025
|
||||
│ │ └── pro_dynamique.py
|
||||
│ └── 12-05-2025
|
||||
│ └── main.py
|
||||
├── readme_creator.txt
|
||||
├── README.html
|
||||
├── README.md
|
||||
├── recursivite
|
||||
│ ├── exercice_MJoannic
|
||||
│ │ ├── dichotomie
|
||||
│ │ │ ├── iteratif
|
||||
│ │ │ │ ├── main.py
|
||||
│ │ │ │ ├── sort_list.py
|
||||
│ │ │ │ └── tester.py
|
||||
│ │ │ └── recursif
|
||||
│ │ │ ├── correction
|
||||
│ │ │ │ └── V1.py
|
||||
│ │ │ └── myself
|
||||
│ │ │ ├── idx
|
||||
│ │ │ │ ├── main.py
|
||||
│ │ │ │ ├── sort_list.py
|
||||
│ │ │ │ └── tester.py
|
||||
│ │ │ ├── main.py
|
||||
│ │ │ ├── sort_list.py
|
||||
│ │ │ └── tester.py
|
||||
│ │ ├── palindrom.py
|
||||
│ │ └── sqrt
|
||||
│ │ ├── correction
|
||||
│ │ │ └── main.py
|
||||
│ │ └── main.py
|
||||
│ └── TD1.py
|
||||
├── sqlite
|
||||
│ ├── test
|
||||
│ └── test-journal
|
||||
├── TDliste2liste
|
||||
│ ├── exercice1.py
|
||||
│ ├── exercice2.py
|
||||
│ ├── exercice3.py
|
||||
│ ├── exercice4.py
|
||||
│ ├── exercice5.py
|
||||
│ └── exercice6.py
|
||||
└── trees
|
||||
├── AB
|
||||
│ └── arbre.py
|
||||
├── ABR
|
||||
│ └── main.py
|
||||
├── genealogie
|
||||
│ ├── genealogie.csv
|
||||
│ ├── genealogie.py
|
||||
│ └── TP_Arbres_Generalites.pdf?forcedownload=1
|
||||
└── qdj.py
|
||||
|
||||
52 directories, 104 files
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
<!--HTML generated by highlight 4.13, http://andre-simon.de/-->
|
||||
171
high-school/README.md
Normal file
171
high-school/README.md
Normal file
@@ -0,0 +1,171 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="ISO-8859-1">
|
||||
<title>Source file</title>
|
||||
<link rel="stylesheet" type="text/css" href="highlight.css">
|
||||
</head>
|
||||
<body class="hl">
|
||||
<pre class="hl">.
|
||||
├── algo2.md
|
||||
├── casse-brique
|
||||
│ ├── main.py
|
||||
│ └── pygame.py
|
||||
├── cesar
|
||||
│ ├── chiffrement.py
|
||||
│ ├── message2.txt
|
||||
│ └── message.txt
|
||||
├── crypto
|
||||
│ ├── algo.py
|
||||
│ └── message
|
||||
├── Dijkstra
|
||||
│ ├── algo.py
|
||||
│ └── fonctions.md
|
||||
├── ensembles_dynamiques
|
||||
│ └── TP
|
||||
│ ├── _collection_list.py
|
||||
│ ├── _collection.py
|
||||
│ ├── data
|
||||
│ │ └── Chartreuse.csv
|
||||
│ ├── main.py
|
||||
│ ├── _sommets_dict.py
|
||||
│ └── _sommets.py
|
||||
├── fibonacci
|
||||
│ ├── code1.py
|
||||
│ ├── complex.py
|
||||
│ └── fibobo
|
||||
│ ├── Cargo.lock
|
||||
│ ├── Cargo.toml
|
||||
│ └── src
|
||||
│ └── main.rs
|
||||
├── fichier.md
|
||||
├── file
|
||||
│ └── new
|
||||
│ └── fifo.py
|
||||
├── fonctions_tri
|
||||
│ └── partitionement.py
|
||||
├── get_bac_subject
|
||||
│ └── get_bac_subject
|
||||
│ ├── Cargo.lock
|
||||
│ ├── Cargo.toml
|
||||
│ ├── src
|
||||
│ │ └── main.rs
|
||||
│ └── url.txt
|
||||
├── graphes
|
||||
│ ├── DS_possible
|
||||
│ │ ├── main.py
|
||||
│ │ └── v
|
||||
│ ├── homework_wednesday.py
|
||||
│ ├── ht
|
||||
│ ├── leaudibidon
|
||||
│ │ ├── correction.py
|
||||
│ │ ├── main.py
|
||||
│ │ └── Water_jug.py
|
||||
│ ├── maze
|
||||
│ │ ├── fifo.py
|
||||
│ │ ├── lifo.py
|
||||
│ │ ├── main.py
|
||||
│ │ ├── maze_creator.py
|
||||
│ │ └── test.py
|
||||
│ ├── monday_homework.py
|
||||
│ └── why
|
||||
├── highlight.css
|
||||
├── LICENSE
|
||||
├── magic_square
|
||||
│ ├── magic_square.py
|
||||
│ ├── td_carre_magique.py
|
||||
│ └── TDliste2liste
|
||||
│ ├── exercice1.py
|
||||
│ ├── exercice2.py
|
||||
│ ├── exercice3.py
|
||||
│ ├── exercice4.py
|
||||
│ ├── exercice5.py
|
||||
│ └── exercice6.py
|
||||
├── Partie2
|
||||
│ └── Eleve
|
||||
│ ├── livres.db
|
||||
│ ├── livres.db-journal
|
||||
│ ├── livres.sql
|
||||
│ ├── p_app_web_python_sqlite.pdf
|
||||
│ ├── Projet
|
||||
│ │ ├── control.py
|
||||
│ │ ├── index.html
|
||||
│ │ ├── __init__.py
|
||||
│ │ └── templates
|
||||
│ │ └── index.html
|
||||
│ └── run.py
|
||||
├── partition_fusion
|
||||
│ ├── code2.py
|
||||
│ ├── code.py
|
||||
│ ├── liste.py
|
||||
│ └── partition_fusion.py
|
||||
├── perfect_number
|
||||
│ └── main.py
|
||||
├── prblm.txt
|
||||
├── prep
|
||||
├── preuve.md
|
||||
├── programmation_dynamique
|
||||
│ ├── bag
|
||||
│ │ └── main.py
|
||||
│ └── monnaie
|
||||
│ ├── piece1.py
|
||||
│ └── piece.py
|
||||
├── question_du_jour
|
||||
│ ├── 05-05-2025
|
||||
│ │ └── pro_dynamique.py
|
||||
│ └── 12-05-2025
|
||||
│ └── main.py
|
||||
├── readme_creator.txt
|
||||
├── README.html
|
||||
├── README.md
|
||||
├── recursivite
|
||||
│ ├── exercice_MJoannic
|
||||
│ │ ├── dichotomie
|
||||
│ │ │ ├── iteratif
|
||||
│ │ │ │ ├── main.py
|
||||
│ │ │ │ ├── sort_list.py
|
||||
│ │ │ │ └── tester.py
|
||||
│ │ │ └── recursif
|
||||
│ │ │ ├── correction
|
||||
│ │ │ │ └── V1.py
|
||||
│ │ │ └── myself
|
||||
│ │ │ ├── idx
|
||||
│ │ │ │ ├── main.py
|
||||
│ │ │ │ ├── sort_list.py
|
||||
│ │ │ │ └── tester.py
|
||||
│ │ │ ├── main.py
|
||||
│ │ │ ├── sort_list.py
|
||||
│ │ │ └── tester.py
|
||||
│ │ ├── palindrom.py
|
||||
│ │ └── sqrt
|
||||
│ │ ├── correction
|
||||
│ │ │ └── main.py
|
||||
│ │ └── main.py
|
||||
│ └── TD1.py
|
||||
├── sqlite
|
||||
│ ├── test
|
||||
│ └── test-journal
|
||||
├── TDliste2liste
|
||||
│ ├── exercice1.py
|
||||
│ ├── exercice2.py
|
||||
│ ├── exercice3.py
|
||||
│ ├── exercice4.py
|
||||
│ ├── exercice5.py
|
||||
│ └── exercice6.py
|
||||
└── trees
|
||||
├── AB
|
||||
│ └── arbre.py
|
||||
├── ABR
|
||||
│ └── main.py
|
||||
├── genealogie
|
||||
│ ├── genealogie.csv
|
||||
│ ├── genealogie.py
|
||||
│ └── TP_Arbres_Generalites.pdf?forcedownload=1
|
||||
└── qdj.py
|
||||
|
||||
52 directories, 104 files
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
<!--HTML generated by highlight 4.13, http://andre-simon.de/-->
|
||||
|
||||
12
high-school/TDliste2liste/exercice1.py
Normal file
12
high-school/TDliste2liste/exercice1.py
Normal file
@@ -0,0 +1,12 @@
|
||||
def appartient(elt, tableau):
|
||||
for i in tableau:
|
||||
if i == elt:
|
||||
return True
|
||||
else:
|
||||
continue
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(appartient(5, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
|
||||
print(appartient(5, [1, 2, 3, 4, 6, 7, 8, 9, 10]))
|
||||
23
high-school/TDliste2liste/exercice2.py
Normal file
23
high-school/TDliste2liste/exercice2.py
Normal file
@@ -0,0 +1,23 @@
|
||||
def max_local(tableau):
|
||||
maximum = tableau[0]
|
||||
for i in tableau:
|
||||
if i > maximum:
|
||||
maximum = i
|
||||
else:
|
||||
continue
|
||||
return maximum
|
||||
|
||||
|
||||
def indice_max(tableau):
|
||||
maximum = max_local(tableau)
|
||||
for i in range(len(tableau)):
|
||||
if tableau[i] == maximum:
|
||||
return i
|
||||
else:
|
||||
continue
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
l1 = [0, 2, 3, 4, 5, 6, 7, 8, 9, 90, 91, 59, 1]
|
||||
print(max_local(l1))
|
||||
print(indice_max(l1))
|
||||
11
high-school/TDliste2liste/exercice3.py
Normal file
11
high-school/TDliste2liste/exercice3.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def cree_tableau_n_m(n, m):
|
||||
return [[0 for _ in range(m)] for _ in range(n)]
|
||||
|
||||
|
||||
def cree_tableau_carre_n(n):
|
||||
return [[0 for _ in range(n)] for _ in range(n)]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(cree_tableau_n_m(3, 5))
|
||||
print(cree_tableau_carre_n(5))
|
||||
13
high-school/TDliste2liste/exercice4.py
Normal file
13
high-school/TDliste2liste/exercice4.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def cree_carre_entier_1_n_carre(n):
|
||||
carre = []
|
||||
compteur = 1
|
||||
for i in range(n):
|
||||
ligne = []
|
||||
for j in range(n):
|
||||
ligne.append(compteur)
|
||||
compteur += 1
|
||||
carre.append(ligne)
|
||||
return carre
|
||||
|
||||
|
||||
print(cree_carre_entier_1_n_carre(8))
|
||||
12
high-school/TDliste2liste/exercice5.py
Normal file
12
high-school/TDliste2liste/exercice5.py
Normal file
@@ -0,0 +1,12 @@
|
||||
def transpose(carre):
|
||||
n = len(carre) # Nombre de lignes (ou colonnes, car c'est une matrice carrée)
|
||||
return [[carre[j][i] for j in range(n)] for i in range(n)]
|
||||
|
||||
|
||||
def transpose_en_place(carre):
|
||||
n = len(carre) # Nombre de lignes (ou colonnes)
|
||||
for i in range(n):
|
||||
for j in range(
|
||||
i + 1, n
|
||||
): # Commencer à j = i + 1 pour éviter de réécrire les éléments déjà transposés
|
||||
carre[i][j], carre[j][i] = carre[j][i], carre[i][j] # Échange des éléments
|
||||
11
high-school/TDliste2liste/exercice6.py
Normal file
11
high-school/TDliste2liste/exercice6.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def diag_1(carre):
|
||||
return [carre[i][i] for i in range(len(carre))]
|
||||
|
||||
|
||||
def diag_2(carre):
|
||||
n = len(carre)
|
||||
return [carre[i][n - 1 - i] for i in range(n)]
|
||||
|
||||
|
||||
def colonne(j, carre):
|
||||
return [carre[i][j] for i in range(len(carre))]
|
||||
23
high-school/algo2.md
Normal file
23
high-school/algo2.md
Normal file
@@ -0,0 +1,23 @@
|
||||
```Plaintext
|
||||
somme(liste)
|
||||
somme = 0
|
||||
idx = 0
|
||||
while idx < |liste|
|
||||
somme = somme + liste[idx]
|
||||
idx = idx + 1
|
||||
```
|
||||
|
||||
# Myself
|
||||
## Preuve de terminaison
|
||||
La *Terminaison* est assurée par un variant de boucle (ici idx < |liste| est un variant de boucle)
|
||||
```plaintext
|
||||
|liste| - idx
|
||||
```
|
||||
est ici l'ivariant de boucle
|
||||
|
||||
## Preuve de correction partielle
|
||||
La correction partielle est assurée par *l'invariant de boucle* ici Somme contient toutes les valeurs de la liste ajouter les unes aux autres ? par
|
||||
```Plaintext
|
||||
somme = somme + liste[idx]
|
||||
```
|
||||
## Conclusion L'algo se termine et, à la sortie, idx = |liste| et somme contient tous les elements de la liste additionés entre eux
|
||||
174
high-school/casse-brique/.gitignore
vendored
Normal file
174
high-school/casse-brique/.gitignore
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# UV
|
||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
#uv.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
# Ruff stuff:
|
||||
.ruff_cache/
|
||||
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
373
high-school/casse-brique/LICENSE
Normal file
373
high-school/casse-brique/LICENSE
Normal file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
7
high-school/casse-brique/README.md
Normal file
7
high-school/casse-brique/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# casse-brique
|
||||
Un casse brique.
|
||||
- bruit, musique et fin de niveau -> branch: music
|
||||
- plusieurs niveau -> branch: niveau
|
||||
- gestion highscore -> branch: score
|
||||
- gestion vie -> branch: vie
|
||||
- briques spéciales -> branch: speciale
|
||||
57
high-school/casse-brique/balle.py
Normal file
57
high-school/casse-brique/balle.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import pygame
|
||||
import math
|
||||
from constantes import *
|
||||
|
||||
|
||||
class Balle:
|
||||
"""
|
||||
Definie une balle qui se deplace dans la fenetre ecran
|
||||
Attributs : rayon, xpos, ypos, xvit, yvit
|
||||
Methodes : deplace, doitRebondir(raquette), affiche
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.rayon = 10
|
||||
self.xpos = LARGEUR_ECRAN / 2
|
||||
self.ypos = HAUTEUR_ECRAN / 2
|
||||
self.xvit = 4.5
|
||||
self.yvit = 3.0
|
||||
|
||||
def doitRebondir(self, raquette):
|
||||
return (
|
||||
self.xpos >= raquette.xpos
|
||||
and self.xpos <= raquette.xpos + raquette.largeur
|
||||
and self.ypos >= HAUTEUR_ECRAN - 30
|
||||
)
|
||||
|
||||
def deplace(self, raquette):
|
||||
self.xpos += self.xvit
|
||||
self.ypos += self.yvit
|
||||
if self.doitRebondir(raquette):
|
||||
angle_degre = 10 + 160 * (
|
||||
1 - (self.xpos - raquette.xpos) / raquette.largeur
|
||||
)
|
||||
angle_radian = angle_degre * math.pi / 180
|
||||
old_xvit = self.xvit
|
||||
self.xvit = math.sqrt(self.xvit**2 + self.yvit**2) * math.cos(angle_radian)
|
||||
self.yvit = -math.sqrt(old_xvit**2 + self.yvit**2) * math.sin(angle_radian)
|
||||
self.xpos += self.xvit
|
||||
self.ypos += self.yvit
|
||||
if self.xpos + self.rayon > LARGEUR_ECRAN or self.xpos - self.rayon < 0:
|
||||
self.xvit = -self.xvit
|
||||
self.xpos += self.xvit
|
||||
self.ypos += self.yvit
|
||||
elif self.ypos - self.rayon < 0:
|
||||
self.yvit = -self.yvit
|
||||
self.xpos += self.xvit
|
||||
self.ypos += self.yvit
|
||||
|
||||
def affiche(self, ecran):
|
||||
pygame.draw.circle(
|
||||
ecran, (0, 0, 0), (int(self.xpos), int(self.ypos)), self.rayon
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
b1 = Balle()
|
||||
print(b1.xpos)
|
||||
37
high-school/casse-brique/bouton.py
Normal file
37
high-school/casse-brique/bouton.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import pygame
|
||||
import pygame.freetype
|
||||
|
||||
|
||||
class Bouton:
|
||||
"""
|
||||
Définie un bouton composé :
|
||||
d'une zone cliquable : un Rect de pygame
|
||||
un texte : à afficher au centre de la zone cliquable
|
||||
une couleur de fond : (r,v,b)
|
||||
éventuellement une font :
|
||||
"""
|
||||
|
||||
def __init__(self, zone, texte, couleur):
|
||||
"""
|
||||
Initialise une instance de bouton.
|
||||
Paramètres :
|
||||
zone : 4-uple (top, left, width, height)
|
||||
texte : String
|
||||
couleur : 3-uple (r,v,b)
|
||||
"""
|
||||
self.zone_cliquable = pygame.Rect(zone)
|
||||
self.texte = texte
|
||||
self.couleur = couleur
|
||||
self.ma_Font = pygame.freetype.SysFont("digital-7.ttf", 20)
|
||||
|
||||
def affiche(self, ecran):
|
||||
"""
|
||||
Affiche dans la surface ecran la Surface associé au Rect
|
||||
avec le texte centré dans la Surface.
|
||||
"""
|
||||
zone_aff = pygame.Surface(self.zone_cliquable.size)
|
||||
zone_aff.fill(self.couleur)
|
||||
ecran.blit(zone_aff, self.zone_cliquable)
|
||||
text_Surf, text_Rect = self.ma_Font.render(self.texte, (0, 0, 0))
|
||||
text_Rect.center = self.zone_cliquable.center
|
||||
ecran.blit(text_Surf, text_Rect)
|
||||
85
high-school/casse-brique/brique.py
Normal file
85
high-school/casse-brique/brique.py
Normal file
@@ -0,0 +1,85 @@
|
||||
import pygame
|
||||
from constantes import *
|
||||
|
||||
|
||||
class Brique:
|
||||
"""
|
||||
Definie l'objet brique immobile dans le jeu.
|
||||
Attributs : xpos, ypos, vie, largeur, hauteur tous de type int
|
||||
Methodes : enVie(), collisionVerticale(balle), collisionHorizontale(balle),
|
||||
collision(balle), affiche()
|
||||
"""
|
||||
|
||||
def __init__(self, xpos, ypos, vie):
|
||||
self.xpos = xpos
|
||||
self.ypos = ypos
|
||||
self.vie = vie
|
||||
self.largeur = LARGEUR_ECRAN // 15
|
||||
self.hauteur = 20
|
||||
|
||||
def enVie(self):
|
||||
"""indique si la brique à un nombre de vie strictement positif
|
||||
Paramètres :
|
||||
une brique mais utiliser br.enVie()
|
||||
Return :
|
||||
True si self.vie > 0
|
||||
False sinon
|
||||
"""
|
||||
return self.vie > 0
|
||||
|
||||
def collisionVerticale(self, balle):
|
||||
return (
|
||||
balle.xpos > self.xpos
|
||||
and balle.xpos < self.xpos + self.largeur
|
||||
and (
|
||||
(balle.ypos < self.ypos and balle.ypos + balle.rayon > self.ypos)
|
||||
or (
|
||||
balle.ypos > self.ypos + self.hauteur
|
||||
and balle.ypos - balle.rayon < self.ypos + self.hauteur
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def collisionHorizontale(self, balle):
|
||||
return (
|
||||
balle.ypos > self.ypos
|
||||
and balle.ypos < self.ypos + self.hauteur
|
||||
and (
|
||||
(balle.xpos < self.xpos and balle.xpos + balle.rayon > self.xpos)
|
||||
or (
|
||||
balle.xpos > self.xpos + self.largeur
|
||||
and balle.xpos - balle.rayon < self.xpos + self.largeur
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def collision(self, balle):
|
||||
if self.enVie():
|
||||
if self.collisionVerticale(balle):
|
||||
balle.yvit = -balle.yvit
|
||||
self.vie -= 1
|
||||
balle.xpos += balle.xvit
|
||||
balle.ypos += balle.yvit
|
||||
elif self.collisionHorizontale(balle):
|
||||
balle.xvit = -balle.xvit
|
||||
self.vie -= 1
|
||||
balle.xpos += balle.xvit
|
||||
balle.ypos += balle.yvit
|
||||
|
||||
def affiche(self, ecran):
|
||||
if self.enVie():
|
||||
pygame.draw.rect(
|
||||
ecran, (0, 0, 0), (self.xpos, self.ypos, self.largeur, self.hauteur)
|
||||
)
|
||||
if self.vie > 1:
|
||||
pygame.draw.rect(
|
||||
ecran,
|
||||
(255, 0, 0),
|
||||
(self.xpos + 1, self.ypos + 1, self.largeur - 2, self.hauteur - 2),
|
||||
)
|
||||
else:
|
||||
pygame.draw.rect(
|
||||
ecran,
|
||||
(0, 255, 0),
|
||||
(self.xpos + 1, self.ypos + 1, self.largeur - 2, self.hauteur - 2),
|
||||
)
|
||||
7
high-school/casse-brique/constantes.py
Normal file
7
high-school/casse-brique/constantes.py
Normal file
@@ -0,0 +1,7 @@
|
||||
##########Definitions des constantes
|
||||
# Taille de la fenetre
|
||||
LARGEUR_ECRAN = 600
|
||||
HAUTEUR_ECRAN = 800
|
||||
# Couleur
|
||||
BLANC = (255, 255, 255)
|
||||
NOIR = (0, 0, 0)
|
||||
16
high-school/casse-brique/highscore.py
Normal file
16
high-school/casse-brique/highscore.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import sys, pygame
|
||||
import bouton
|
||||
from constantes import *
|
||||
|
||||
|
||||
class Highscore:
|
||||
""" """
|
||||
|
||||
def __init__(self):
|
||||
self.fichier = "highscore.txt"
|
||||
self.bouton_quitter = bouton.Bouton(
|
||||
(100, 100, 400, 100), "Retour au Menu", (255, 0, 0)
|
||||
)
|
||||
|
||||
def gereHighScore(self, ecran):
|
||||
pass
|
||||
1
high-school/casse-brique/highscore.txt
Normal file
1
high-school/casse-brique/highscore.txt
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
63
high-school/casse-brique/jeu.py
Normal file
63
high-school/casse-brique/jeu.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import sys, pygame
|
||||
import niveau
|
||||
from constantes import *
|
||||
|
||||
|
||||
class Jeu:
|
||||
"""gère les différents états d'un jeu"""
|
||||
|
||||
def __init__(self):
|
||||
self.n1 = niveau.Niveau()
|
||||
self.vie = 3
|
||||
self.bouge = False
|
||||
self.etatJeu = 1
|
||||
|
||||
def gereJeu(self, ecran):
|
||||
if self.etatJeu == 1: # Debut de niveau
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT: # Evt de sortie de boucle
|
||||
sys.exit()
|
||||
elif event.type == pygame.MOUSEBUTTONDOWN:
|
||||
self.bouge = True
|
||||
elif event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:
|
||||
self.bouge = True
|
||||
self.n1.affiche(ecran)
|
||||
if self.bouge:
|
||||
self.etatJeu = 2
|
||||
elif self.etatJeu == 2: # Niveau en cours
|
||||
self.etatJeu = self.n1.gereNiveau(ecran)
|
||||
elif self.etatJeu == 3: # Changement de niveau
|
||||
pass
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
"""
|
||||
while True: #Demarrage de la boucle infinie
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT: #Evt de sortie de boucle
|
||||
sys.exit()
|
||||
elif event.type == pygame.MOUSEBUTTONDOWN:
|
||||
bouge = not bouge
|
||||
elif event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:
|
||||
bouge = not bouge
|
||||
if pygame.key.get_pressed()[pygame.K_q] == True:
|
||||
r1.deplaceGauche()
|
||||
if pygame.key.get_pressed()[pygame.K_d] == True:
|
||||
r1.deplaceDroite()
|
||||
|
||||
ecran.fill(BLANC)
|
||||
|
||||
if bouge:
|
||||
b1.deplace(r1)
|
||||
m1.collision(b1)
|
||||
|
||||
b1.affiche(ecran)
|
||||
r1.affiche(ecran)
|
||||
m1.affiche(ecran)
|
||||
|
||||
|
||||
|
||||
pygame.display.update() #rafraichissement
|
||||
clock.tick(60)
|
||||
"""
|
||||
55
high-school/casse-brique/main.py
Normal file
55
high-school/casse-brique/main.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import sys, pygame
|
||||
import bouton
|
||||
import constantes
|
||||
import pygame.freetype
|
||||
import jeu, highscore
|
||||
|
||||
|
||||
def affiche_menu(ecran):
|
||||
b1.affiche(ecran)
|
||||
b2.affiche(ecran)
|
||||
b3.affiche(ecran)
|
||||
return 0
|
||||
|
||||
|
||||
pygame.init() # initialisation des modules de pygame
|
||||
|
||||
# Creation de la fenetre
|
||||
ecran = pygame.display.set_mode((constantes.LARGEUR_ECRAN, constantes.HAUTEUR_ECRAN))
|
||||
ecran.fill(constantes.BLANC)
|
||||
pygame.display.set_caption("Casse Brique")
|
||||
|
||||
clock = pygame.time.Clock()
|
||||
|
||||
b1 = bouton.Bouton((100, 100, 400, 100), "Jouer", (255, 0, 0))
|
||||
b2 = bouton.Bouton((100, 300, 400, 100), "Highscore", (255, 0, 0))
|
||||
b3 = bouton.Bouton((100, 500, 400, 100), "Quitter", (255, 0, 0))
|
||||
hs1 = highscore.Highscore()
|
||||
j1 = jeu.Jeu()
|
||||
etat = 0
|
||||
|
||||
|
||||
while True: # Demarrage de la boucle infinie
|
||||
if etat == 0:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT: # Evt de sortie de boucle
|
||||
sys.exit()
|
||||
elif event.type == pygame.MOUSEBUTTONUP and event.button == 1:
|
||||
if b1.zone_cliquable.collidepoint(event.pos):
|
||||
etat = 1
|
||||
elif b2.zone_cliquable.collidepoint(event.pos):
|
||||
etat = 2
|
||||
elif b3.zone_cliquable.collidepoint(event.pos):
|
||||
sys.exit()
|
||||
|
||||
ecran.fill(constantes.BLANC)
|
||||
|
||||
if etat == 0:
|
||||
etat = affiche_menu(ecran)
|
||||
elif etat == 1:
|
||||
etat = j1.gereJeu(ecran)
|
||||
elif etat == 2:
|
||||
etat = hs1.gereHighScore(ecran)
|
||||
|
||||
pygame.display.update() # rafraichissement
|
||||
clock.tick(60)
|
||||
33
high-school/casse-brique/murdebrique.py
Normal file
33
high-school/casse-brique/murdebrique.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import brique
|
||||
from constantes import *
|
||||
|
||||
|
||||
class Murdebrique:
|
||||
"""
|
||||
definie un mur compose de briques 15 en largeur et 5 rangees
|
||||
Les briques ont une largeur de LARGEUR_ECRAN//15 et une hauteur de 20
|
||||
Il doit y avoir 50 px au dessus du mur.
|
||||
La rangée du haut contient des briques ayant 2 vies
|
||||
Attributs : mur de type liste
|
||||
Méthodes : collision(balle), affiche(ecran)
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.mur = []
|
||||
ligne = []
|
||||
for i in range(15):
|
||||
ligne.append(brique.Brique((LARGEUR_ECRAN // 15) * i, 50, 2))
|
||||
for i in range(4):
|
||||
for j in range(15):
|
||||
ligne.append(brique.Brique((LARGEUR_ECRAN // 15) * j, 70 + 20 * i, 1))
|
||||
self.mur.append(ligne)
|
||||
|
||||
def collision(self, balle):
|
||||
for i in range(len(self.mur)):
|
||||
for j in range(len(self.mur[i])):
|
||||
self.mur[i][j].collision(balle)
|
||||
|
||||
def affiche(self, ecran):
|
||||
for i in range(len(self.mur)):
|
||||
for j in range(len(self.mur[i])):
|
||||
self.mur[i][j].affiche(ecran)
|
||||
32
high-school/casse-brique/niveau.py
Normal file
32
high-school/casse-brique/niveau.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import sys, pygame
|
||||
import balle, raquette, murdebrique
|
||||
from constantes import *
|
||||
|
||||
|
||||
class Niveau:
|
||||
"""gère le jeu d'un niveau"""
|
||||
|
||||
def __init__(self):
|
||||
self.b1 = balle.Balle()
|
||||
self.r1 = raquette.Raquette()
|
||||
self.m1 = murdebrique.Murdebrique()
|
||||
|
||||
def affiche(self, ecran):
|
||||
ecran.fill(BLANC)
|
||||
self.b1.affiche(ecran)
|
||||
self.r1.affiche(ecran)
|
||||
self.m1.affiche(ecran)
|
||||
|
||||
def gereNiveau(self, ecran):
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT: # Evt de sortie de boucle
|
||||
sys.exit()
|
||||
if pygame.key.get_pressed()[pygame.K_q] == True:
|
||||
self.r1.deplaceGauche()
|
||||
if pygame.key.get_pressed()[pygame.K_d] == True:
|
||||
self.r1.deplaceDroite()
|
||||
|
||||
self.b1.deplace(self.r1)
|
||||
self.m1.collision(self.b1)
|
||||
self.affiche(ecran)
|
||||
return 2
|
||||
59
high-school/casse-brique/raquette.py
Normal file
59
high-school/casse-brique/raquette.py
Normal file
@@ -0,0 +1,59 @@
|
||||
import pygame
|
||||
from constantes import *
|
||||
|
||||
|
||||
class Raquette:
|
||||
"""
|
||||
Definie une raquette qui se deplace horizontalement
|
||||
dans le bas de la fenetre ecran
|
||||
Attributs : largeur (int defaut 100), xpos (int defaut LARGEUR_ECRAN//2 - self.largeur//2), vit (int defaut 6)
|
||||
L'épaisseur de la raquette est de 10
|
||||
Methodes : deplaceGauche, deplaceDroite, affiche
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.largeur = 100
|
||||
self.xpos = LARGEUR_ECRAN // 2 - self.largeur // 2
|
||||
self.vit = 6
|
||||
|
||||
def deplaceGauche(self):
|
||||
"""
|
||||
Deplace la raquette de vit vers la gauche
|
||||
Parametres :
|
||||
self : Raquette
|
||||
Return :
|
||||
None
|
||||
Effet de bord :
|
||||
Modifie l'attribut xpos en lui enlevant,
|
||||
si c'est possible la valeur de vit (et met xpos à 0 sinon)
|
||||
"""
|
||||
if self.xpos - self.vit < 0:
|
||||
self.xpos = 0
|
||||
else:
|
||||
self.xpos = self.xpos - self.vit
|
||||
|
||||
def deplaceDroite(self):
|
||||
"""
|
||||
Deplace la raquette de vit vers la droite
|
||||
Parametres :
|
||||
self : Raquette
|
||||
Return :
|
||||
None
|
||||
Effet de bord :
|
||||
Modifie l'attribut xpos en lui ajoutant,
|
||||
si c'est possible la valeur de vit (et met xpos à
|
||||
LARGEUR_ECRAN-self.largeur sinon sinon)
|
||||
"""
|
||||
if self.xpos + self.largeur + self.vit > LARGEUR_ECRAN:
|
||||
self.xpos = LARGEUR_ECRAN - self.largeur
|
||||
else:
|
||||
self.xpos = self.xpos + self.vit
|
||||
|
||||
def affiche(self, ecran):
|
||||
pygame.draw.rect(
|
||||
ecran, (0, 0, 255), (int(self.xpos), HAUTEUR_ECRAN - 20, self.largeur, 10)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
34
high-school/cesar/chiffrement.py
Normal file
34
high-school/cesar/chiffrement.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import string
|
||||
|
||||
|
||||
def load_file():
|
||||
with open("message.txt", "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
return content
|
||||
|
||||
|
||||
lower_case = string.ascii_lowercase
|
||||
upper_case = string.ascii_uppercase
|
||||
|
||||
|
||||
def dechiffrer(content, step):
|
||||
resultat = ""
|
||||
|
||||
for char in content:
|
||||
if char in lower_case:
|
||||
index = (lower_case.index(char) - step) % 26
|
||||
resultat += lower_case[index]
|
||||
elif char in upper_case:
|
||||
index = (upper_case.index(char) - step) % 26
|
||||
resultat += upper_case[index]
|
||||
else:
|
||||
resultat += char
|
||||
|
||||
return resultat
|
||||
|
||||
|
||||
contenu = load_file()
|
||||
texte_dechiffre = dechiffrer(contenu, step=17)
|
||||
|
||||
print("Texte déchiffré :")
|
||||
print(texte_dechiffre)
|
||||
3
high-school/cesar/message.txt
Normal file
3
high-school/cesar/message.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Le tfisvrl, rprek mfcv le dfitvrl uv mzreuv, j vkrzk gvityv jli le risiv. Le iveriu c rgvitlk, vk, mflcrek jv iveuiv drzkiv uv cr mzreuv, jv gfjkr uvmrek clz vk cflr jvj gifgfikzfej vcvxrekvj vk jr svrlkv, raflkrek hlv elc e vkrzk dzvlo wrzk hlv clz gfli êkiv cv ifz uvj fzjvrlo, vk hl zc cv jvirzk uvmvel j livdvek, j zc rmrzk uv cr mfzo. Cv tfisvrl, mflcrek clz dfekivi hlv cr mfzo efe gclj ev clz drehlrzk grj, crtyr cr mzreuv vk gfljjr uv xireuj tizj. Cv iveriu jv givtzgzkr vk, jrzjzjjrek cv dfitvrl, uzk :
|
||||
F tfisvrl, jz kl rmrzj rljjz ul alxvdvek, zc ev kv drehlvirzk izve gfli uvmvezi cv ifz uvj fzjvrlo.
|
||||
Tvkkv wrscv vjk lev cvtfe gfli cvj jfkj.
|
||||
1
high-school/cesar/message2.txt
Normal file
1
high-school/cesar/message2.txt
Normal file
@@ -0,0 +1 @@
|
||||
1 0 83 37 61 134 5 27 49 78 0 78 189 26 18 7 32 78 30 6 37 27 154 73 48 11 83 5 53 78 31 12 58 26 22 28 38 78 23 78 33 0 22 73 0 1 1 29 33 11 95 73 94 10 22 73 48 135 3 0 32 78 22 5 56 11 83 5 49 78 23 128 50 7 18 73 180 78 31 8 116 13 28 28 38 29 22 71 116 100 63 12 116 34 26 129 34 28 22 73 56 15 83 31 59 7 7 73 36 15 1 29 61 28 83 12 32 78 31 8 116 2 18 0 39 29 22 73 39 7 83 11 61 11 29 73 53 24 18 7 55 11 1 69 116 100 2 28 49 78 2 28 49 2 2 28 49 29 83 12 50 8 28 27 32 29 83 24 33 73 26 5 116 8 157 29 116 11 29 26 33 7 7 12 120 78 121 12 56 2 22 73 32 1 6 10 60 15 83 5 49 78 17 28 32 78 18 31 53 0 7 73 56 27 26 71
|
||||
72
high-school/crypto/algo.py
Normal file
72
high-school/crypto/algo.py
Normal file
@@ -0,0 +1,72 @@
|
||||
def est_premier(n):
|
||||
"""Vérifie si un nombre est premier."""
|
||||
if n < 2:
|
||||
return False
|
||||
for i in range(2, int(n**0.5) + 1):
|
||||
if n % i == 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def liste_premier_inf(n):
|
||||
return [i for i in range(2, n + 1) if est_premier(i)]
|
||||
|
||||
|
||||
def pgcd(a, b):
|
||||
while b:
|
||||
a, b = b, a % b
|
||||
return a
|
||||
|
||||
|
||||
def cle_publique_possible(a, b):
|
||||
n = a * b
|
||||
return [i for i in range(1, n) if pgcd(i, n) == 1]
|
||||
|
||||
|
||||
def inverse(e, n):
|
||||
t, newt = 0, 1
|
||||
r, newr = n, e
|
||||
while newr != 0:
|
||||
quotient = r // newr
|
||||
t, newt = newt, t - quotient * newt
|
||||
r, newr = newr, r - quotient * newr
|
||||
if r > 1:
|
||||
raise ValueError("L'inverse modulaire n'existe pas.")
|
||||
if t < 0:
|
||||
t += n
|
||||
return t
|
||||
|
||||
|
||||
def chaine_en_liste(chaine):
|
||||
return [ord(c) for c in chaine]
|
||||
|
||||
|
||||
def chiffre(e, N, liste):
|
||||
return [pow(x, e, N) for x in liste]
|
||||
|
||||
|
||||
def dechiffre(d, N, liste):
|
||||
return [pow(x, d, N) for x in liste]
|
||||
|
||||
|
||||
def liste_en_chaine(liste):
|
||||
return "".join(chr(x) for x in liste)
|
||||
|
||||
|
||||
cle = 17873
|
||||
a, b = 61, 53
|
||||
N = a * b
|
||||
phi = (a - 1) * (b - 1)
|
||||
e = 18607
|
||||
print(N)
|
||||
d = inverse(e, phi)
|
||||
|
||||
message = "「有時,沒有人期待能做出什麼的人,卻完成了沒有人能想像的事。」"
|
||||
message_code = chaine_en_liste(message)
|
||||
message_chiffre = chiffre(e, N, message_code)
|
||||
message_dechiffre = dechiffre(d, N, message_chiffre)
|
||||
message_final = liste_en_chaine(message_dechiffre)
|
||||
|
||||
print("Message initial:", message)
|
||||
print("Message chiffré:", message_chiffre)
|
||||
print("Message déchiffré:", message_final)
|
||||
1
high-school/crypto/message
Executable file
1
high-school/crypto/message
Executable file
@@ -0,0 +1 @@
|
||||
[18802, 561, 13389, 1494, 561, 8038, 2177, 9098, 14888, 9098, 12143, 561, 8038, 12143, 9098, 2925, 19036, 9098, 26542, 561, 13389, 468, 19036, 20236]
|
||||
192
high-school/ensembles_dynamiques/TP/_collection.py
Normal file
192
high-school/ensembles_dynamiques/TP/_collection.py
Normal file
@@ -0,0 +1,192 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
#################################
|
||||
#
|
||||
# _COLLECTION.PY
|
||||
# --------------
|
||||
#
|
||||
# Module du type ensemble
|
||||
#
|
||||
#################################
|
||||
|
||||
# Un ensemble est une collection d'éléments, d'occurence unique.
|
||||
# Les fonctions sont implémentées dans le paradigme fonctionnel.
|
||||
|
||||
|
||||
def initialiser_ensemble():
|
||||
"""
|
||||
Construit un ensemble vide.
|
||||
|
||||
Paramètre :
|
||||
- aucun
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE vide
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord
|
||||
- aucune
|
||||
"""
|
||||
return set()
|
||||
|
||||
|
||||
def est_ensemble_vide(ensemble):
|
||||
"""
|
||||
Teste si l'ensemble est vide.
|
||||
|
||||
Paramètre :
|
||||
- ensemble : ENSEMBLE, l'ensemble à tester
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return len(ensemble) == 0
|
||||
|
||||
|
||||
def copier_ensemble(ensemble):
|
||||
"""
|
||||
Construit la copie d'un ensemble.
|
||||
|
||||
Paramètre :
|
||||
- ensemble : ENSEMBLE, la source
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE : une copie de la source
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
resultat = initialiser_ensemble()
|
||||
for _ in ensemble:
|
||||
resultat.add(_)
|
||||
return resultat
|
||||
|
||||
|
||||
def ajouter(ensemble, element):
|
||||
"""
|
||||
Ajoute un element à la copie d'un ensemble
|
||||
|
||||
Paramètres :
|
||||
- ensemble : ENSEMBLE, l'ensemble à abonder
|
||||
- element : ANY, l'élément à ajouter
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE, l'ensemble abondé
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
resultat = copier_ensemble(ensemble)
|
||||
resultat.add(element)
|
||||
return resultat
|
||||
|
||||
|
||||
def supprimer(ensemble, element):
|
||||
"""
|
||||
Construire une copie de l'ensemble privé d'un élément.
|
||||
Si l'élément à supprimer n'est pas dans l'ensemble initial,
|
||||
alors une copie intégrale est renvoyée.
|
||||
|
||||
Paramètres :
|
||||
- ensemble ; ENSEMBLE, la collection à amender
|
||||
- element : ANY, l'élément à supprimer
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE, la copie amendée de l'ensemble
|
||||
"""
|
||||
resultat = initialiser_ensemble()
|
||||
for _ in ensemble:
|
||||
if not (_ == element):
|
||||
resultat = ajouter(resultat, _)
|
||||
return resultat
|
||||
|
||||
|
||||
def rechercher(ensemble, cle, critere=lambda x, y: x == y):
|
||||
"""
|
||||
Construit la sous-collection constituée des éléments d'un ensemble
|
||||
dont la clé satisfait un critère donné.
|
||||
|
||||
Paramètres :
|
||||
- ensemble : ENSEMBLE, la collection à explorer
|
||||
- cle : ANY, la clé à rechercher
|
||||
- critere : FUNCTION ou LAMBDA, test utilisé pour la recherche
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE, la collection extraite des éléments satisfaisant le test
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
resultat = initialiser_ensemble()
|
||||
for _ in ensemble:
|
||||
if critere(_, cle):
|
||||
resultat = ajouter(resultat, _)
|
||||
return resultat
|
||||
|
||||
|
||||
def supprimer_critere(ensemble, cle, critere):
|
||||
"""
|
||||
Construit la collection des éléments d'un ensemble,
|
||||
dont la clé satisfait le critère donné.
|
||||
|
||||
Paramètres :
|
||||
- ensemble : ENSEMBLE, la collection source
|
||||
- cle : ANY, la clé à employer pour la suppression
|
||||
- critere : FUNCTION ou LAMBDA, critère de sélection
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE : la copie de l'ensemble amendée
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
resultat = copier_ensemble(ensemble)
|
||||
elements = rechercher(ensemble, cle, critere)
|
||||
for _ in elements:
|
||||
resultat = supprimer(resultat, _)
|
||||
return resultat
|
||||
|
||||
|
||||
def lister(ensemble, affichage=print):
|
||||
"""
|
||||
Afficher le contenu d'un ensemble,
|
||||
en formattant chaque élément selon la fonction d'affichage fournie.
|
||||
|
||||
Paramètres :
|
||||
- ensemble : ENSEMBLE, la collection à énumérer
|
||||
- affichage : FUNCTION, la fonction à appliquer à chaque élément.
|
||||
|
||||
Résultat :
|
||||
- None : NONETYPE
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- Affichage sur la sortie standard
|
||||
"""
|
||||
for element in ensemble:
|
||||
affichage(element)
|
||||
return None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
177
high-school/ensembles_dynamiques/TP/_collection_list.py
Normal file
177
high-school/ensembles_dynamiques/TP/_collection_list.py
Normal file
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
#################################
|
||||
#
|
||||
# _COLLECTION_LIST.PY
|
||||
# -------------------
|
||||
#
|
||||
# Module du type ensemble
|
||||
# implémenté sur les listes
|
||||
#################################
|
||||
|
||||
# Un ensemble est une collection d'éléments, d'occurence unique.
|
||||
# Les fonctions sont implémentées dans le paradigme fonctionnel.
|
||||
|
||||
|
||||
def initialiser_ensemble():
|
||||
"""
|
||||
Construit un ensemble vide.
|
||||
|
||||
Paramètre :
|
||||
- aucun
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE vide
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucune
|
||||
"""
|
||||
return list()
|
||||
|
||||
|
||||
def est_ensemble_vide(ensemble):
|
||||
"""
|
||||
Teste si l'ensemble est vide.
|
||||
|
||||
Paramètre :
|
||||
- ensemble : LIST, l'ensemble à tester
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return len(ensemble) == 0
|
||||
|
||||
|
||||
def copier_ensemble(ensemble):
|
||||
"""
|
||||
Construit la copie d'un ensemble.
|
||||
|
||||
Paramètre :
|
||||
- ensemble : LIST, la source
|
||||
|
||||
Résultat :
|
||||
- LIST : une copie de la source
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return ensemble[:]
|
||||
|
||||
|
||||
def ajouter(ensemble, element):
|
||||
"""
|
||||
Ajoute un element à la copie d'un ensemble
|
||||
|
||||
Paramètres :
|
||||
- ensemble : LIST, l'ensemble à abonder
|
||||
- element : ANY, l'élément à ajouter
|
||||
|
||||
Résultat :
|
||||
- LIST, l'ensemble abondé
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
copie = ensemble.copy()
|
||||
copie.append(element)
|
||||
return copie
|
||||
|
||||
|
||||
def supprimer(ensemble, element):
|
||||
"""
|
||||
Construire une copie de l'ensemble privé d'un élément.
|
||||
Si l'élément à supprimer n'est pas dans l'ensemble initial,
|
||||
alors une copie intégrale est renvoyée.
|
||||
|
||||
Paramètres :
|
||||
- ensemble ; LIST, la collection à amender
|
||||
- element : ANY, l'élément à supprimer
|
||||
|
||||
Résultat :
|
||||
- LIST, la copie amendée de l'ensemble
|
||||
"""
|
||||
resultat = ensemble[:]
|
||||
return resultat.remove(element)
|
||||
|
||||
|
||||
def rechercher(ensemble, cle, critere=lambda x, y: x == y):
|
||||
"""
|
||||
Construit la sous-collection constituée des éléments d'un ensemble
|
||||
dont la clé satisfait un critère donné.
|
||||
|
||||
Paramètres :
|
||||
- ensemble : LIST, la collection à explorer
|
||||
- cle : ANY, la clé à rechercher
|
||||
- critere : FUNCTION ou LAMBDA, test utilisé pour la recherche
|
||||
|
||||
Résultat :
|
||||
- LIST, la collection extraite des éléments satisfaisant le test
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return [element for element in ensemble if critere(element, cle)]
|
||||
|
||||
|
||||
def supprimer_critere(ensemble, cle, critere):
|
||||
"""
|
||||
Construit la collection des éléments d'un ensemble,
|
||||
dont la clé satisfait le critère donné.
|
||||
|
||||
Paramètres :
|
||||
- ensemble : LIST, la collection source
|
||||
- cle : ANY, la clé à employer pour la suppression
|
||||
- critere : FUNCTION ou LAMBDA, critère de sélection
|
||||
|
||||
Résultat :
|
||||
- LIST : la copie de l'ensemble amendée
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return [element for element in ensemble if not critere(element, cle)]
|
||||
|
||||
|
||||
def lister(ensemble, affichage=print):
|
||||
"""
|
||||
Afficher le contenu d'un ensemble,
|
||||
en formattant chaque élément selon la fonction d'affichage fournie.
|
||||
|
||||
Paramètres :
|
||||
- ensemble : LIST, la collection à énumérer
|
||||
- affichage : FUNCTION, la fonction à appliquer à chaque élément.
|
||||
|
||||
Résultat :
|
||||
- None : NONETYPE
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- Affichage sur la sortie standard
|
||||
"""
|
||||
for item in ensemble:
|
||||
affichage(item)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
184
high-school/ensembles_dynamiques/TP/_sommets.py
Normal file
184
high-school/ensembles_dynamiques/TP/_sommets.py
Normal file
@@ -0,0 +1,184 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
###################################
|
||||
#
|
||||
# _SOMMETS.PY
|
||||
# -----------
|
||||
#
|
||||
# Module de traitement des Sommets
|
||||
#
|
||||
###################################
|
||||
|
||||
# Un sommet est un tuple (nom, altitude, massif)
|
||||
# - nom : STR
|
||||
# - altitude : INT, altitude en m
|
||||
# - massif : STR
|
||||
|
||||
|
||||
def creer_sommet(nom, altitude, massif):
|
||||
"""
|
||||
Construit le tuple sommet.
|
||||
|
||||
Paramètres :
|
||||
- nom : STR, le nom du sommet
|
||||
- altitude : INT, l'altitude en m
|
||||
- massif : STR, le massif contenant le sommet
|
||||
|
||||
Résultat :
|
||||
- TUPLE, le sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune (programmation défensive à envisager)
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return (nom, altitude, massif)
|
||||
|
||||
|
||||
def altitude_en_m(altitude):
|
||||
"""
|
||||
Conversion de l'altitude en entier ("2 062 m" -> 2062)
|
||||
|
||||
Paramètre :
|
||||
- altitude : STR, chaîne du type "2 062 m", avec espaces et 'm'
|
||||
|
||||
Résultat :
|
||||
- INT, l'altitude en m
|
||||
|
||||
Pré-condition :
|
||||
- aucune (prog def à envisager)
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
tmp = ""
|
||||
for symbole in altitude:
|
||||
if not (symbole in " m"):
|
||||
tmp += symbole
|
||||
return int(tmp)
|
||||
|
||||
|
||||
def creer_sommet_csv(ligne, massif):
|
||||
"""
|
||||
Construit un sommet à partir d'une ligne du fichier csv.
|
||||
|
||||
Paramètres :
|
||||
- ligne : STR, ligne du fichier csv
|
||||
- massif : STR, basename du fichier contenant la ligne
|
||||
|
||||
Résultat :
|
||||
- TUPLE, le sommet correspondant
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
nom, alt = ligne.rstrip().split(",")
|
||||
return creer_sommet(nom, altitude_en_m(alt), massif)
|
||||
|
||||
|
||||
def afficher(sommet):
|
||||
"""
|
||||
Affichage formatté du sommet.
|
||||
|
||||
Paramètres :
|
||||
- sommet : TUPLE, le sommet à afficher
|
||||
|
||||
Résultat :
|
||||
- NONETYPE, None
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- Affichage sur la sortie standard
|
||||
"""
|
||||
nom, altitude, massif = sommet
|
||||
print(f"{nom:35s}\t[{massif}]\n\taltitude : {altitude} m")
|
||||
return None
|
||||
|
||||
|
||||
def nom(sommet):
|
||||
"""
|
||||
Consulte le nom d'un sommet
|
||||
|
||||
Paramètre :
|
||||
- sommet : TUPLE
|
||||
|
||||
Résultat :
|
||||
- STR, le nom du sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return sommet[0]
|
||||
|
||||
|
||||
def altitude(sommet):
|
||||
"""
|
||||
Consulte l'altitude d'un sommet
|
||||
|
||||
Paramètre :
|
||||
- sommet : TUPLE
|
||||
|
||||
Résultat :
|
||||
- INT : l'altitude du sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return sommet[1]
|
||||
|
||||
|
||||
def massif(sommet):
|
||||
"""
|
||||
Consulte le massif d'un sommet
|
||||
|
||||
Paramètre :
|
||||
- sommet : TUPLE
|
||||
|
||||
Résultat :
|
||||
- STR, le massif du sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return sommet[2]
|
||||
|
||||
|
||||
def coincide_nom(sommet, motif):
|
||||
"""
|
||||
Compare le nom du sommet au motif
|
||||
|
||||
Paramètres :
|
||||
- sommet : TUPLE, le sommet à tester
|
||||
- motif : STR, le motif à identifier
|
||||
|
||||
Résultat :
|
||||
- BOOL : Vrai ssi le nom du sommet correspond au motif
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
nom_sommet = nom(sommet)
|
||||
return (len(motif) <= len(nom_sommet)) and (nom_sommet[: len(motif)] == motif)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
189
high-school/ensembles_dynamiques/TP/_sommets_dict.py
Normal file
189
high-school/ensembles_dynamiques/TP/_sommets_dict.py
Normal file
@@ -0,0 +1,189 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
############################
|
||||
#
|
||||
# _SOMMETS_DICT.PY
|
||||
# ----------------
|
||||
#
|
||||
# Module des sommets
|
||||
# implémentés par des dict
|
||||
############################
|
||||
|
||||
# Un sommet est un dictionnaire
|
||||
# dont les clés sont 'nom', 'altitude' et 'massif'
|
||||
# - nom : STR
|
||||
# - altitude : INT, altitude en m
|
||||
# - massif : STR
|
||||
|
||||
|
||||
def creer_sommet(nom, altitude, massif):
|
||||
"""
|
||||
Construit le dico sommet.
|
||||
|
||||
Paramètres :
|
||||
- nom : STR, le nom du sommet
|
||||
- altitude : INT, l'altitude en m
|
||||
- massif : STR, le massif contenant le sommet
|
||||
|
||||
Résultat :
|
||||
- DICT, le sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune (programmation défensive à envisager)
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
sommet = {"Nom": nom, "Altitude": altitude, "Massif": massif}
|
||||
|
||||
return sommet
|
||||
|
||||
|
||||
def altitude_en_m(altitude):
|
||||
"""
|
||||
Conversion de l'altitude en entier ("2 062 m" -> 2062)
|
||||
|
||||
Paramètre :
|
||||
- altitude : STR, chaîne du type "2 062 m", avec espaces et 'm'
|
||||
|
||||
Résultat :
|
||||
- INT, l'altitude en m
|
||||
|
||||
Pré-condition :
|
||||
- aucune (prog def à envisager)
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
tmp = ""
|
||||
for symbole in altitude:
|
||||
if not (symbole in " m"):
|
||||
tmp += symbole
|
||||
return int(tmp)
|
||||
|
||||
|
||||
def creer_sommet_csv(ligne, massif):
|
||||
"""
|
||||
Construit un sommet à partir d'une ligne du fichier csv.
|
||||
|
||||
Paramètres :
|
||||
- ligne : STR, ligne du fichier csv
|
||||
- massif : STR, basename du fichier contenant la ligne
|
||||
|
||||
Résultat :
|
||||
- DICT, le sommet correspondant
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
nom, alt = ligne.rstrip().split(",")
|
||||
return creer_sommet(nom, altitude_en_m(alt), massif)
|
||||
|
||||
|
||||
def afficher(sommet):
|
||||
"""
|
||||
Affichage formatté du sommet.
|
||||
|
||||
Paramètres :
|
||||
- sommet : TUPLE, le sommet à afficher
|
||||
|
||||
Résultat :
|
||||
- NONETYPE, None
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- Affichage sur la sortie standard
|
||||
"""
|
||||
|
||||
print(
|
||||
f"{sommet['Nom']:35s}\t[{sommet['Massif']}]\n\taltitude : {sommet['Altitude']} m"
|
||||
)
|
||||
|
||||
|
||||
def nom(sommet):
|
||||
"""
|
||||
Consulte le nom d'un sommet
|
||||
|
||||
Paramètre :
|
||||
- sommet : DICT
|
||||
|
||||
Résultat :
|
||||
- STR, le nom du sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return sommet["Nom"]
|
||||
|
||||
|
||||
def altitude(sommet):
|
||||
"""
|
||||
Consulte l'altitude d'un sommet
|
||||
|
||||
Paramètre :
|
||||
- sommet : DICT
|
||||
|
||||
Résultat :
|
||||
- INT : l'altitude du sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return sommet["Altitude"]
|
||||
|
||||
|
||||
def massif(sommet):
|
||||
"""
|
||||
Consulte le massif d'un sommet
|
||||
|
||||
Paramètre :
|
||||
- sommet : DICT
|
||||
|
||||
Résultat :
|
||||
- STR, le massif du sommet
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return sommet["Massif"]
|
||||
|
||||
|
||||
def coincide_nom(sommet, motif):
|
||||
"""
|
||||
Compare le nom du sommet au motif
|
||||
|
||||
Paramètres :
|
||||
- sommet : TUPLE, le sommet à tester
|
||||
- motif : STR, le motif à identifier
|
||||
|
||||
Résultat :
|
||||
- BOOL : Vrai ssi le nom du sommet correspond au motif
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
|
||||
nom_sommet = nom(sommet)
|
||||
return (len(motif) <= len(nom_sommet)) and (nom_sommet[: len(motif)] == motif)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
29
high-school/ensembles_dynamiques/TP/data/Chartreuse.csv
Normal file
29
high-school/ensembles_dynamiques/TP/data/Chartreuse.csv
Normal file
@@ -0,0 +1,29 @@
|
||||
Grande Sure (La), 1 920 m
|
||||
Rocher de Lorzier (Le), 1 838 m
|
||||
Rochers de Chalves (Les), 1 845 m
|
||||
Rocher de l'Église (Le), 1 300 m
|
||||
Pointe de la Gorgeat (La), 1 486 m
|
||||
Mont Joigny (Le), 1 556 m
|
||||
Mont Outheran (Le), 1 673 m
|
||||
Cochette (La), 1 618 m
|
||||
Roc de Gleisin (Le), 1 434 m
|
||||
Roche Veyrand (La), 1 429 m
|
||||
Dent de l'Ours (La), 1 820 m
|
||||
Petit Som (Le), 1 772 m
|
||||
Grand Som (Le), 2 026 m
|
||||
Charmant Som (Le), 1 867 m
|
||||
Pinéa (La), 1 771 m
|
||||
Néron (Le), 1 299 m
|
||||
Mont Granier (Le), 1 933 m
|
||||
Sommet du Pinet (Le) ou le Truc, 1 867 m
|
||||
Grand Manti (Le), 1 818 m
|
||||
Scia (La), 1 791 m
|
||||
Lances de Malissard (Les), 2 045 m
|
||||
Dôme de Bellefont (Le), 1 975 m
|
||||
Dent de Crolles (La), 2 062 m
|
||||
Piton de Bellefont (Le), 1 958 m
|
||||
Chamechaude, 2 082 m
|
||||
Grands Crêts (Les), 1 489 m
|
||||
Mont Saint-Eynard (Le), 1 379 m
|
||||
Écoutoux (L'), 1 406 m
|
||||
Rachais (Le), 1 050 m
|
||||
|
70
high-school/ensembles_dynamiques/TP/main.py
Normal file
70
high-school/ensembles_dynamiques/TP/main.py
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
#######################################
|
||||
#
|
||||
# MAIN.PY
|
||||
# -------
|
||||
#
|
||||
# Interface principale
|
||||
#
|
||||
#######################################
|
||||
|
||||
import _collection_list as col
|
||||
import _sommets as som
|
||||
|
||||
# Le module _collection définit nos ENSEMBLES
|
||||
# Le module _sommets définit nos SOMMETS
|
||||
|
||||
|
||||
def file_2_set(fichier="./data/Chartreuse.csv"):
|
||||
"""
|
||||
Lecture du fichier csv contenant les caractéristiques des sommets.
|
||||
|
||||
Paramètres :
|
||||
- fichier : STR, le nom complet du fichier csv à parcourir
|
||||
|
||||
Résultat :
|
||||
- resultat : ENSEMBLE, la collection des sommets
|
||||
|
||||
Pré-conditions :
|
||||
- aucune
|
||||
|
||||
Effets de bord :
|
||||
- aucun
|
||||
"""
|
||||
massif = fichier[7:-4]
|
||||
resultat = col.initialiser_ensemble()
|
||||
with open(fichier) as src:
|
||||
ligne = src.readline()
|
||||
while ligne:
|
||||
resultat = col.ajouter(resultat, som.creer_sommet_csv(ligne, massif))
|
||||
ligne = src.readline()
|
||||
return resultat
|
||||
|
||||
|
||||
def rechercher(ensemble, motif):
|
||||
"""
|
||||
Recherche les sommets de la collection dont le nom
|
||||
correspond à un motif donné.
|
||||
|
||||
Paramètres :
|
||||
- ensemble : ENSEMBLE, la collection des somets
|
||||
- motif : STR, la chaîne de caractères à identifier
|
||||
|
||||
Résultat :
|
||||
- ENSEMBLE, la sous-collection des sommets satisfaisant au critère
|
||||
|
||||
Pré-condition :
|
||||
- aucune
|
||||
|
||||
Effet de bord :
|
||||
- aucun
|
||||
"""
|
||||
return col.rechercher(ensemble, motif, som.coincide_nom)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
col.lister(
|
||||
col.supprimer_critere(file_2_set(), "Grand", som.coincide_nom), som.afficher
|
||||
)
|
||||
18
high-school/fibonacci/code1.py
Normal file
18
high-school/fibonacci/code1.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
def fibobo(n):
|
||||
if n <= 1:
|
||||
return n
|
||||
return fibobo(n - 1) + fibobo(n - 2)
|
||||
|
||||
|
||||
print(fibobo(30))
|
||||
|
||||
|
||||
def fibibi(n):
|
||||
fibi = np.array([[1, 1], [1, 0]])
|
||||
return np.linalg.matrix_power(fibi, n)[0][-1]
|
||||
|
||||
|
||||
print(fibibi(100))
|
||||
67
high-school/fibonacci/complex.py
Normal file
67
high-school/fibonacci/complex.py
Normal file
@@ -0,0 +1,67 @@
|
||||
import numpy as np
|
||||
import time
|
||||
import matplotlib.pyplot as plt
|
||||
import math
|
||||
|
||||
|
||||
# Définir les fonctions
|
||||
def fibobo(n):
|
||||
if n <= 1:
|
||||
return n
|
||||
return fibobo(n - 1) + fibobo(n - 2)
|
||||
|
||||
|
||||
def fibibi(n):
|
||||
fibi = np.array([[1, 1], [1, 0]])
|
||||
return np.linalg.matrix_power(fibi, n)[0][-1]
|
||||
|
||||
|
||||
# Benchmark des temps d'exécution
|
||||
n_values_recursive = range(
|
||||
1, 35, 1
|
||||
) # Plage raisonnable pour fibobo (approche récursive)
|
||||
n_values_matrix = range(1, 50, 1) # Limiter n pour éviter les dépassements avec 2^n
|
||||
|
||||
# Temps pour fibobo
|
||||
times_recursive = []
|
||||
for n in n_values_recursive:
|
||||
start_time = time.time()
|
||||
fibobo(n)
|
||||
times_recursive.append(time.time() - start_time)
|
||||
|
||||
# Temps pour fibibi
|
||||
times_matrix = []
|
||||
for n in n_values_matrix:
|
||||
start_time = time.time()
|
||||
fibibi(n)
|
||||
times_matrix.append(time.time() - start_time)
|
||||
|
||||
# Calculer log(n) et 2^n pour comparaison
|
||||
log_n = [math.log(n) for n in n_values_matrix]
|
||||
exp_2_n = [2**n for n in n_values_matrix]
|
||||
|
||||
# Graphique
|
||||
plt.figure(figsize=(12, 8))
|
||||
|
||||
# Graphe des temps pour fibobo
|
||||
plt.plot(n_values_recursive, times_recursive, label="fibobo (récursif)", marker="o")
|
||||
|
||||
# Graphe des temps pour fibibi
|
||||
plt.plot(n_values_matrix, times_matrix, label="fibibi (matriciel)", marker="s")
|
||||
|
||||
# Ajouter log(n) pour comparaison simple
|
||||
plt.plot(n_values_matrix, log_n, label="log(n)", linestyle="--")
|
||||
|
||||
# Ajouter 2^n pour comparaison simple
|
||||
plt.plot(n_values_matrix, exp_2_n, label="2^n", linestyle=":")
|
||||
|
||||
# Ajuster l'échelle de l'axe y pour éviter les dépassements
|
||||
plt.yscale("log") # Échelle logarithmique pour mieux visualiser les variations
|
||||
plt.ylim(1e-6, 1e10) # Limiter les valeurs extrêmes
|
||||
|
||||
plt.title("Comparaison des performances avec log(n) et 2^n")
|
||||
plt.xlabel("Valeur de n")
|
||||
plt.ylabel("Temps d'exécution ou croissance (échelle logarithmique)")
|
||||
plt.legend(loc="upper left")
|
||||
plt.grid()
|
||||
plt.show()
|
||||
7
high-school/fibonacci/fibobo/Cargo.lock
generated
Normal file
7
high-school/fibonacci/fibobo/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "fibobo"
|
||||
version = "0.1.0"
|
||||
6
high-school/fibonacci/fibobo/Cargo.toml
Normal file
6
high-school/fibonacci/fibobo/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "fibobo"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
12
high-school/fibonacci/fibobo/src/main.rs
Normal file
12
high-school/fibonacci/fibobo/src/main.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let f = fibobo(30);
|
||||
println!("{f}");
|
||||
}
|
||||
|
||||
fn fibobo(n: u64) -> u64 {
|
||||
if n <= 1 {
|
||||
return n;
|
||||
}
|
||||
return fibobo(n - 1) + fibobo(n - 2);
|
||||
}
|
||||
177
high-school/fichier.md
Normal file
177
high-school/fichier.md
Normal file
@@ -0,0 +1,177 @@
|
||||
```
|
||||
.
|
||||
├── elouan_fare
|
||||
│ └── tp6
|
||||
│ ├── LSC.py
|
||||
│ ├── npi.py
|
||||
│ ├── Pile_List.py
|
||||
│ ├── Pile_LSC.py
|
||||
│ ├── Pile_Tuple.py
|
||||
│ ├── __pycache__
|
||||
│ │ ├── LSC.cpython-312.pyc
|
||||
│ │ ├── Pile_List.cpython-312.pyc
|
||||
│ │ ├── Pile_LSC.cpython-312.pyc
|
||||
│ │ └── Pile_Tuple.cpython-312.pyc
|
||||
│ ├── README.md
|
||||
│ ├── test.py
|
||||
│ └── TP_Piles.pdf
|
||||
├── elouan_fare.tar.gz
|
||||
├── elouan_fare_v2
|
||||
│ └── tp6_self
|
||||
│ ├── LSC.py
|
||||
│ ├── npi.py
|
||||
│ ├── Pile_List.py
|
||||
│ ├── Pile_LSC.py
|
||||
│ ├── Pile_Tuple.py
|
||||
│ ├── __pycache__
|
||||
│ │ ├── LSC.cpython-312.pyc
|
||||
│ │ ├── Pile_List.cpython-312.pyc
|
||||
│ │ ├── Pile_LSC.cpython-312.pyc
|
||||
│ │ └── Pile_Tuple.cpython-312.pyc
|
||||
│ ├── README.md
|
||||
│ └── test.py
|
||||
├── elouan_fare_v2.tar.gz
|
||||
├── ensembles_dynamiques
|
||||
│ └── TP
|
||||
│ ├── _collection_list.py
|
||||
│ ├── _collection.py
|
||||
│ ├── data
|
||||
│ │ └── Chartreuse.csv
|
||||
│ ├── main.py
|
||||
│ ├── __pycache__
|
||||
│ │ ├── _collection.cpython-312.pyc
|
||||
│ │ ├── _collection_list.cpython-312.pyc
|
||||
│ │ ├── _sommets.cpython-312.pyc
|
||||
│ │ └── _sommets_dict.cpython-312.pyc
|
||||
│ ├── _sommets_dict.py
|
||||
│ └── _sommets.py
|
||||
├── fichier.md
|
||||
├── file
|
||||
│ ├── file_LSC.py
|
||||
│ ├── file.py
|
||||
│ ├── file_tuple.py
|
||||
│ └── LSC.py
|
||||
├── fn_test_tri_bynome
|
||||
├── LICENSE
|
||||
├── magic_square
|
||||
│ ├── magic_square.py
|
||||
│ ├── __pycache__
|
||||
│ │ └── td_carre_magique.cpython-312.pyc
|
||||
│ ├── td_carre_magique.py
|
||||
│ └── TDliste2liste
|
||||
│ ├── exercice1.py
|
||||
│ ├── exercice2.py
|
||||
│ ├── exercice3.py
|
||||
│ ├── exercice4.py
|
||||
│ ├── exercice5.py
|
||||
│ ├── exercice6.py
|
||||
│ └── __pycache__
|
||||
│ └── exercice6.cpython-312.pyc
|
||||
├── Partie2
|
||||
│ └── Eleve
|
||||
│ ├── livres.db
|
||||
│ ├── livres.db-journal
|
||||
│ ├── livres.sql
|
||||
│ ├── p_app_web_python_sqlite.pdf
|
||||
│ ├── Projet
|
||||
│ │ ├── control.py
|
||||
│ │ ├── index.html
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── __pycache__
|
||||
│ │ │ ├── control.cpython-313.pyc
|
||||
│ │ │ └── __init__.cpython-313.pyc
|
||||
│ │ └── templates
|
||||
│ │ └── index.html
|
||||
│ └── run.py
|
||||
├── partition_fusion
|
||||
│ └── code.py
|
||||
├── README.md
|
||||
├── recurivite
|
||||
│ ├── exercice_MJoannic
|
||||
│ │ ├── dichotomie
|
||||
│ │ │ ├── iteratif
|
||||
│ │ │ │ ├── main.py
|
||||
│ │ │ │ ├── sort_list.py
|
||||
│ │ │ │ └── tester.py
|
||||
│ │ │ └── recursif
|
||||
│ │ │ ├── correction
|
||||
│ │ │ │ └── V1.py
|
||||
│ │ │ └── myself
|
||||
│ │ │ ├── main.py
|
||||
│ │ │ ├── sort_list.py
|
||||
│ │ │ └── tester.py
|
||||
│ │ └── palindrom.py
|
||||
│ └── TD1.py
|
||||
├── sqlite
|
||||
│ ├── test
|
||||
│ └── test-journal
|
||||
├── TDliste2liste
|
||||
│ ├── exercice1.py
|
||||
│ ├── exercice2.py
|
||||
│ ├── exercice3.py
|
||||
│ ├── exercice4.py
|
||||
│ ├── exercice5.py
|
||||
│ └── exercice6.py
|
||||
├── tp6
|
||||
│ ├── LSC.py
|
||||
│ ├── npi.py
|
||||
│ ├── Pile_List.py
|
||||
│ ├── Pile_LSC.py
|
||||
│ ├── Pile_Tuple.py
|
||||
│ ├── __pycache__
|
||||
│ │ ├── LSC.cpython-312.pyc
|
||||
│ │ ├── Pile_List.cpython-312.pyc
|
||||
│ │ ├── Pile_LSC.cpython-312.pyc
|
||||
│ │ └── Pile_Tuple.cpython-312.pyc
|
||||
│ ├── README.md
|
||||
│ ├── test.py
|
||||
│ └── TP_Piles.pdf
|
||||
├── TP6
|
||||
│ ├── LSC.py
|
||||
│ ├── Pile_List.py
|
||||
│ ├── Pile_LSC.py
|
||||
│ ├── Pile_Tuple.py
|
||||
│ ├── __pycache__
|
||||
│ │ ├── LSC.cpython-312.pyc
|
||||
│ │ ├── Pile_List.cpython-312.pyc
|
||||
│ │ ├── Pile_LSC.cpython-312.pyc
|
||||
│ │ └── Pile_Tuple.cpython-312.pyc
|
||||
│ ├── test_2.py
|
||||
│ │ ├── modules.rst
|
||||
│ │ ├── Pile_List.rst
|
||||
│ │ ├── Pile_Tuple.rst
|
||||
│ │ └── test.rst
|
||||
│ ├── test.py
|
||||
│ ├── test.py.patch
|
||||
│ └── TP_Piles.pdf
|
||||
├── tp6_self
|
||||
│ ├── LSC.py
|
||||
│ ├── npi.py
|
||||
│ ├── Pile_List.py
|
||||
│ ├── Pile_LSC.py
|
||||
│ ├── Pile_Tuple.py
|
||||
│ ├── __pycache__
|
||||
│ │ ├── LSC.cpython-312.pyc
|
||||
│ │ ├── Pile_List.cpython-312.pyc
|
||||
│ │ ├── Pile_LSC.cpython-312.pyc
|
||||
│ │ └── Pile_Tuple.cpython-312.pyc
|
||||
│ ├── README.md
|
||||
│ └── test.py
|
||||
└── tp_listes_chaines
|
||||
├── execute.py
|
||||
├── fichiers
|
||||
│ ├── Chartreuse.csv
|
||||
│ ├── factorial.py
|
||||
│ ├── LSC.py
|
||||
│ ├── __pycache__
|
||||
│ │ ├── LSC.cpython-312.pyc
|
||||
│ │ └── Sommets.cpython-312.pyc
|
||||
│ ├── Sommets.py
|
||||
│ ├── test.py
|
||||
│ ├── TP5_1.py
|
||||
│ └── TP5.py
|
||||
├── TP 5 Listes Chaînées-20240925.zip
|
||||
└── TP5_Listes_Chainees.pdf
|
||||
|
||||
42 directories, 131 files
|
||||
```
|
||||
0
high-school/file/new/fifo.py
Normal file
0
high-school/file/new/fifo.py
Normal file
28
high-school/fonctions_tri/partitionement.py
Normal file
28
high-school/fonctions_tri/partitionement.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from typing import Any
|
||||
|
||||
|
||||
def partitionement(liste: list[Any], debut, fin):
|
||||
pivot = liste[debut]
|
||||
gauche = debut + 1
|
||||
droite = fin - 1
|
||||
while gauche <= droite:
|
||||
while (gauche <= droite) and (liste[gauche] <= pivot):
|
||||
gauche += 1
|
||||
|
||||
while (gauche <= droite) and (liste[droite] > pivot):
|
||||
droite -= 1
|
||||
|
||||
if gauche < droite:
|
||||
exchange(liste, gauche, droite)
|
||||
gauche += 1
|
||||
droite -= 1
|
||||
exchange(liste, droite, debut)
|
||||
return droite
|
||||
|
||||
|
||||
def exchange(liste, indx_g, indx_d):
|
||||
liste[indx_g], liste[indx_d] = liste[indx_d], liste[indx_g]
|
||||
|
||||
|
||||
l = [12, 4, 0, 44, 27]
|
||||
print(partitionement(l, 0, len(l) - 1))
|
||||
1412
high-school/get_bac_subject/get_bac_subject/Cargo.lock
generated
Normal file
1412
high-school/get_bac_subject/get_bac_subject/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
high-school/get_bac_subject/get_bac_subject/Cargo.toml
Normal file
8
high-school/get_bac_subject/get_bac_subject/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "get_bac_subject"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
reqwest = { version = "0.11", features = ["blocking"] }
|
||||
19
high-school/get_bac_subject/get_bac_subject/src/main.rs
Normal file
19
high-school/get_bac_subject/get_bac_subject/src/main.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
fn download_file(url: &str, output_path: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let response = get(url)?;
|
||||
if !response.status().is_success()
|
||||
let mut dest = File::create(Path::new(output_path))?;
|
||||
let mut content = response;
|
||||
copy(&mut content, &mut dest)?;
|
||||
println!("📥 Downloaded: {} → {}", url, output_path);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let url = "https://drive.proton.me/urls/XZ780G6P1M#kXUbcVjBlXPJ";
|
||||
let output = "sujets.zip";
|
||||
|
||||
if let Err(e) = download_file(url, output) {
|
||||
eprintln!("❌ Erreur: {}", e);
|
||||
}
|
||||
}
|
||||
1
high-school/get_bac_subject/get_bac_subject/url.txt
Normal file
1
high-school/get_bac_subject/get_bac_subject/url.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://drive.proton.me/urls/XZ780G6P1M#kXUbcVjBlXPJ
|
||||
26
high-school/graphes/DS_possible/main.py
Normal file
26
high-school/graphes/DS_possible/main.py
Normal file
@@ -0,0 +1,26 @@
|
||||
graphe = {
|
||||
"node1": ["node2", "node4"],
|
||||
"node2": ["node2", "node3", "node6"],
|
||||
"node3": ["node5"],
|
||||
"node5": ["node5", "node6"],
|
||||
"node4": ["node1", "node5"],
|
||||
"node6": [],
|
||||
}
|
||||
print(graphe["node1"])
|
||||
|
||||
|
||||
def bfs(graphe, start_node):
|
||||
queue = [start_node]
|
||||
|
||||
visited = set()
|
||||
while queue:
|
||||
node = queue.pop(0)
|
||||
if node not in visited:
|
||||
print(node)
|
||||
visited.add(node)
|
||||
for neighbor in graphe[node]:
|
||||
if neighbor not in visited:
|
||||
queue.append(neighbor)
|
||||
|
||||
|
||||
bfs(graphe, "node1")
|
||||
BIN
high-school/graphes/DS_possible/v
Normal file
BIN
high-school/graphes/DS_possible/v
Normal file
Binary file not shown.
57
high-school/graphes/homework_wednesday.py
Normal file
57
high-school/graphes/homework_wednesday.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# Chatgpt code
|
||||
|
||||
import heapq
|
||||
|
||||
|
||||
def dijkstra(graph, source):
|
||||
distances = {node: float("inf") for node in graph}
|
||||
distances[source] = 0
|
||||
|
||||
previous = {node: None for node in graph}
|
||||
|
||||
queue = [(0, source)]
|
||||
|
||||
while queue:
|
||||
current_distance, current_node = heapq.heappop(queue)
|
||||
|
||||
if current_distance > distances[current_node]:
|
||||
continue
|
||||
|
||||
for neighbor, weight in graph[current_node]:
|
||||
distance = current_distance + weight
|
||||
if distance < distances[neighbor]:
|
||||
distances[neighbor] = distance
|
||||
previous[neighbor] = current_node
|
||||
heapq.heappush(queue, (distance, neighbor))
|
||||
|
||||
return distances, previous
|
||||
|
||||
|
||||
def reconstruct_path(previous, start, end):
|
||||
path = []
|
||||
node = end
|
||||
while node is not None:
|
||||
path.append(node)
|
||||
node = previous[node]
|
||||
path.reverse()
|
||||
return path
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
graph = {
|
||||
"R1": [("R2", 1)],
|
||||
"R2": [("R3", 1), ("R5", 10)],
|
||||
"R3": [("R4", 1), ("R5", 1)],
|
||||
"R5": [("R4", 10)],
|
||||
"R4": [],
|
||||
}
|
||||
|
||||
source = "R1"
|
||||
destination = "R4"
|
||||
|
||||
distances, previous = dijkstra(graph, source)
|
||||
|
||||
print("Shortest distances from", source, ":", distances)
|
||||
|
||||
path = reconstruct_path(previous, source, destination)
|
||||
print("Shortest path from", source, "to", destination, ":", path)
|
||||
0
high-school/graphes/ht
Normal file
0
high-school/graphes/ht
Normal file
368
high-school/graphes/leaudibidon/Water_jug.py
Normal file
368
high-school/graphes/leaudibidon/Water_jug.py
Normal file
@@ -0,0 +1,368 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- Coding: utf-8 -*-
|
||||
|
||||
|
||||
class Graphe_Oriente(object):
|
||||
"""
|
||||
Classe des Graphes Orientés (GO).
|
||||
|
||||
Les graphes sont représentés par
|
||||
- une liste de sommets
|
||||
- leur liste d'adjacence
|
||||
|
||||
Attributs (publics)
|
||||
- sommets : liste des sommets
|
||||
- voisins : dictionnaire des listes d'adjacence
|
||||
|
||||
Méthodes (publiques)
|
||||
- ajoute_sommet : ajout d'un sommet
|
||||
- ajoute_arcs : ajout d'un arc
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.sommets = list()
|
||||
self.voisins = dict()
|
||||
return None
|
||||
|
||||
def ajoute_sommet(self, s):
|
||||
"""
|
||||
Ajoute le sommet s à l'instance de GO.
|
||||
|
||||
:param s data: etiquette du sommet
|
||||
"""
|
||||
|
||||
self.sommets.append(s)
|
||||
self.voisins[s] = list()
|
||||
return None
|
||||
|
||||
def ajoute_arc(self, origine, extremite):
|
||||
"""
|
||||
Ajoute l'arc origine -> extremite à l'instance de GO.
|
||||
|
||||
:param self Graphe_Oriente: instance à laquelle ajouter un arc
|
||||
:param origine data: un sommet de l'instance, origine de l'arc
|
||||
:param extremite data: un sommet de l'instance, extremité de l'arc
|
||||
|
||||
:return None:
|
||||
|
||||
:effet de bord: Modification de l'instance
|
||||
|
||||
:pré-condition: les sommets doivent exister
|
||||
"""
|
||||
assert origine in self.sommets, "{} inconnu".format(origine)
|
||||
assert extremite in self.sommets, "{} inconnu".format(extremite)
|
||||
self.voisins[origine].append(extremite)
|
||||
return None
|
||||
|
||||
|
||||
def construire_chemins(graphe, depart):
|
||||
"""
|
||||
Construit tous les cheminement du graphe de depart donné
|
||||
|
||||
:param graphe GO: graphe à parcourir
|
||||
:param depart data: sommet de départ dans le graphe
|
||||
|
||||
:return resultat dict: dictionnaire
|
||||
- clef : sommet atteint
|
||||
- valeur : tuple (longueur itinéraire, sommet prédécesseur)
|
||||
|
||||
:effet de bord: Aucun
|
||||
>>> graphe = Graphe_Oriente()
|
||||
>>> graphe.ajoute_sommet('A')
|
||||
>>> graphe.ajoute_sommet('B')
|
||||
>>> graphe.ajoute_sommet('C')
|
||||
>>> graphe.ajoute_arc('A', 'B')
|
||||
>>> graphe.ajoute_arc('B', 'C')
|
||||
>>> construire_chemins(graphe, 'A')
|
||||
{'A': (0, None), 'B': (1, 'A'), 'C': (2, 'B')}
|
||||
"""
|
||||
resultat = dict()
|
||||
file = [depart] # initialise une file (sous forme de liste ici)
|
||||
resultat[depart] = (0, None) # None car le depart n'a aucun predesseceur
|
||||
while len(file) > 0:
|
||||
sommet = file.pop(0) # retire le premier element de la file -> FIFO
|
||||
for voisin in graphe.voisins[sommet]: # Parcours tous les voisins du sommet
|
||||
if (
|
||||
voisin not in resultat
|
||||
): # Verifie que cette partie de l arbre (ou du graphe) n a pas deja ete explorer
|
||||
distance = (
|
||||
resultat[sommet][0] + 1
|
||||
) # Definie distance -> Distance du dernier sommet + 1
|
||||
resultat[voisin] = (
|
||||
distance,
|
||||
sommet,
|
||||
) # Insere le nouveau sommet dans le dictionnaire
|
||||
file.append(
|
||||
voisin
|
||||
) # Permet la reiteration de la boucle a partir de se sommet
|
||||
|
||||
return resultat
|
||||
|
||||
|
||||
def reconstruire_chemin_vers(dico_chemins, *arrivee):
|
||||
"""
|
||||
Remonte tout l'itinéraire depuis un sommet fixé
|
||||
vers un ou des sommets du graphe
|
||||
|
||||
:param dico_chemins dict: table des longueurs/prédécessurs
|
||||
:param *arrivee: nombre quelconque de sommet à atteindre
|
||||
(si vide, on considère tous les sommets)
|
||||
:return resultat list: liste des chemins ie des listes de sommets traversés
|
||||
>>> dico_chemins = {'A': (0, None), 'B': (1, 'A'), 'C': (2, 'B')}
|
||||
>>> reconstruire_chemin_vers(dico_chemins, 'C')
|
||||
[['A', 'B', 'C']]
|
||||
"""
|
||||
chemins = list()
|
||||
cibles = arrivee # Creer une liste avec les sommets a remonter
|
||||
if len(cibles) == 0:
|
||||
return list(
|
||||
dico_chemins.keys()
|
||||
) # si la liste est vide, on renvoie les chemins (sans leurs attributs)
|
||||
for sommet in cibles:
|
||||
sous_chemin = []
|
||||
current = sommet
|
||||
while current is not None:
|
||||
sous_chemin.insert(
|
||||
0, current
|
||||
) # on insere le sommet au début de la liste (permet de maintenir l ordre)
|
||||
current = dico_chemins[current][
|
||||
1
|
||||
] # on change current avec le sommet predesseceur pour que la boucle continue
|
||||
chemins.append(sous_chemin)
|
||||
return chemins
|
||||
|
||||
|
||||
def affichage_chemin(chemin):
|
||||
"""
|
||||
Produit le texte d'affichage d'un chemin
|
||||
|
||||
:param chemin list: liste des sommets constituant le chemin
|
||||
:return string: chemin mis en forme pour affichage
|
||||
"""
|
||||
long = len(chemin) - 1
|
||||
return "{} etapes :\n".format(long) + "\n\t-> ".join(
|
||||
[str(sommet) for sommet in chemin]
|
||||
)
|
||||
|
||||
|
||||
# DEFINITION DES OPERATIONS DE TRANSITION
|
||||
|
||||
|
||||
def vider(numero, etat):
|
||||
"""
|
||||
Vide un bidon
|
||||
|
||||
:param numero INT: index du bidon
|
||||
:param etat tuple: etat des bidons avant l'opération
|
||||
:return tuple: nouvel etat aprés opération
|
||||
:effet de bord: aucun
|
||||
>>> vider(1,(3,5,2))
|
||||
(3, 0, 2)
|
||||
"""
|
||||
index_b = list(etat)
|
||||
index_b[numero] = 0
|
||||
return tuple(index_b)
|
||||
|
||||
|
||||
def remplir(numero, etat, capacites):
|
||||
"""
|
||||
Remplit un bidon
|
||||
|
||||
:param numero INT: index du bidon
|
||||
:param etat tuple: etat des bidons avant l'opération
|
||||
:param capacites tuple: capacités des bidons
|
||||
:return tuple: nouvel etat aprés opération
|
||||
:effet de bord: aucun
|
||||
|
||||
>>> remplir(1, (3, 2, 1), (5, 4, 3))
|
||||
(3, 4, 1)
|
||||
"""
|
||||
cap = list(capacites)
|
||||
index_b = list(etat)
|
||||
index_b[numero] = cap[numero]
|
||||
return tuple(index_b)
|
||||
|
||||
|
||||
def transvaser(source, destination, etat, capacites):
|
||||
"""
|
||||
Transvase un bidon dans un autre
|
||||
|
||||
:param origine int: index du bidon source
|
||||
:param destination int: index du bidon destination
|
||||
:param etas tuple: etat des bidons avant l'opération
|
||||
:param capacites tuple: capacités des bidons
|
||||
:return tuple: nouvel etat aprés opération
|
||||
:effet de bord: aucun
|
||||
>>> transvaser(0, 1, (3, 2, 1), (5, 4, 3))
|
||||
(1, 4, 1)
|
||||
"""
|
||||
transfer_amount = min(
|
||||
list(etat)[source], list(capacites)[destination] - list(etat)[destination]
|
||||
)
|
||||
new_state = list(etat)
|
||||
|
||||
new_state[source] -= transfer_amount
|
||||
new_state[destination] += transfer_amount
|
||||
return tuple(new_state)
|
||||
|
||||
|
||||
# FONCTION LIEES AU GRAPHE DU WATER_JUG
|
||||
|
||||
|
||||
# Pour construire les etats
|
||||
def produit_cartesien(*listes):
|
||||
"""
|
||||
Concatène les tuples issus des différentes listes
|
||||
|
||||
:param *listes: un nombre quelconque de listes de tuples
|
||||
:return list: une liste des tuples concaténés
|
||||
|
||||
Exemple
|
||||
--------
|
||||
>>> produit_cartesien([(1,2), (3, 4)], [(5, 6), (7, 8,)])
|
||||
[(1, 2, 5, 6), (1, 2, 7, 8), (3, 4, 5, 6), (3, 4, 7, 8)]
|
||||
"""
|
||||
if listes == None:
|
||||
return []
|
||||
if len(listes) == 1:
|
||||
return listes[0]
|
||||
result = []
|
||||
for elt in listes[0]:
|
||||
for tuples in produit_cartesien(*listes[1:]):
|
||||
result.append(elt + tuples)
|
||||
return result
|
||||
|
||||
|
||||
def creer_water_jug(*capacites):
|
||||
"""
|
||||
Création du graphe de Water Jug en fonction des capacités des bidons
|
||||
|
||||
:param *capacites: capacités des bidons disponibles
|
||||
:return resultat GO: le graphe orienté du W_J
|
||||
:pre-condition: au moins 2 bidons
|
||||
|
||||
:effet de bord: Aucun
|
||||
"""
|
||||
nb_bidons = len(capacites)
|
||||
assert nb_bidons >= 2, "Pas assez de bidons"
|
||||
resultat = Graphe_Oriente()
|
||||
# CREATION DES SOMMETS
|
||||
etats_marginaux = [
|
||||
[(contenu,) for contenu in range(1 + capacite)] for capacite in capacites
|
||||
]
|
||||
etats_systeme = produit_cartesien(*etats_marginaux)
|
||||
for etat in etats_systeme:
|
||||
resultat.ajoute_sommet(etat)
|
||||
# CREATION DES TRANSITIONS
|
||||
for sommet in resultat.sommets:
|
||||
voisins = list()
|
||||
# VIDER
|
||||
for bidon in range(nb_bidons):
|
||||
voisin = vider(bidon, sommet)
|
||||
if voisin != sommet and not (voisin in voisins):
|
||||
voisins.append(voisin)
|
||||
# REMPLIR
|
||||
for bidon in range(nb_bidons):
|
||||
voisin = remplir(bidon, sommet, capacites)
|
||||
if voisin != sommet and not (voisin in voisins):
|
||||
voisins.append(voisin)
|
||||
# TRANSVASER
|
||||
for origine in range(nb_bidons):
|
||||
for destination in range(nb_bidons):
|
||||
if origine != destination:
|
||||
voisin = transvaser(origine, destination, sommet, capacites)
|
||||
if voisin != sommet and not (voisin in voisins):
|
||||
voisins.append(voisin)
|
||||
# CREATION LISTES ADJACENCE
|
||||
for voisin in voisins:
|
||||
resultat.ajoute_arc(sommet, voisin)
|
||||
return resultat
|
||||
|
||||
|
||||
def atteindre(quantite, graphe_water_jug, depart=None, plus_court=False):
|
||||
"""
|
||||
Résolution du problème pour une quantite donnée
|
||||
|
||||
:param quantite int: la quantité à mesurer
|
||||
:param graphe_water_jug GO: le graphe de la situation
|
||||
:param depart tuple: etat initial, sommet d'origine dans le graphe
|
||||
(bidons tous vides si depart est None, ie non fourni)
|
||||
:param plus_court bool: si vrai, seul le(s) plus court(s) chemin(s)
|
||||
est (sont) retenu(s)
|
||||
|
||||
:return list: la liste des tuples (sommet arrivee, nb d'etapes, ititneraire) ok
|
||||
"""
|
||||
if depart is None:
|
||||
nb_bidons = len(graphe_water_jug.sommets[0])
|
||||
depart = tuple([0 for _ in range(nb_bidons)])
|
||||
chemins = construire_chemins(graphe_water_jug, depart)
|
||||
resultat = list()
|
||||
for sommet in chemins:
|
||||
if quantite in sommet:
|
||||
longueur, _ = chemins[sommet]
|
||||
chemin = reconstruire_chemin_vers(chemins, sommet).pop()
|
||||
index = len(resultat)
|
||||
resultat.append((sommet, longueur, chemin))
|
||||
while index > 0:
|
||||
if resultat[index - 1][1] < longueur:
|
||||
break
|
||||
else:
|
||||
resultat[index], resultat[index - 1] = (
|
||||
resultat[index - 1],
|
||||
resultat[index],
|
||||
)
|
||||
index -= 1
|
||||
if len(resultat) < 2 or not (plus_court):
|
||||
return resultat
|
||||
mini = resultat[0][1]
|
||||
return [element for element in resultat if element[1] == mini]
|
||||
|
||||
|
||||
def main():
|
||||
solutions = atteindre(4, creer_water_jug(3, 5))
|
||||
|
||||
for sommet_final, nb_etapes, chemin in solutions:
|
||||
print(f"sommet atteint: {sommet_final}, en {nb_etapes} etapes")
|
||||
print(affichage_chemin(chemin))
|
||||
print("--------------------------------------")
|
||||
|
||||
|
||||
def question1():
|
||||
|
||||
print("Non pas tous les quantités de litres peuvent être représenter comme 6l.")
|
||||
|
||||
|
||||
def question2():
|
||||
for i in range(10):
|
||||
resolutions = atteindre(i, creer_water_jug(3, 5), None, True)
|
||||
for sommet_final, nb_etapes, chemin in resolutions:
|
||||
print(f"sommet atteint: {sommet_final}, en {nb_etapes} etapes")
|
||||
print(affichage_chemin(chemin))
|
||||
print("--------------------------------------")
|
||||
|
||||
|
||||
def question3():
|
||||
solution = atteindre(4, creer_water_jug(3, 5), None, True)
|
||||
for sommet_final, nb_etapes, chemin in solution:
|
||||
print(f"sommet atteint: {sommet_final}, en {nb_etapes} etapes")
|
||||
print(affichage_chemin(chemin))
|
||||
print("--------------------------------------")
|
||||
|
||||
|
||||
def question4():
|
||||
solution = atteindre(1, creer_water_jug(3, 5, 9), None, True)
|
||||
for sommet_final, nb_etapes, chemin in solution:
|
||||
print(f"sommet atteint: {sommet_final}, en {nb_etapes} etapes")
|
||||
print(affichage_chemin(chemin))
|
||||
print("--------------------------------------")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod(verbose=True)
|
||||
main()
|
||||
question1()
|
||||
question2()
|
||||
question3()
|
||||
question4()
|
||||
20
high-school/graphes/leaudibidon/correction.py
Normal file
20
high-school/graphes/leaudibidon/correction.py
Normal file
@@ -0,0 +1,20 @@
|
||||
def produit_cartesien(*listes):
|
||||
if not listes:
|
||||
return []
|
||||
if len(listes) == 1:
|
||||
return listes[0]
|
||||
if len(listes) == 2:
|
||||
liste1, liste2 = listes
|
||||
resultat = list()
|
||||
for tuple_1 in liste1:
|
||||
for tuple_2 in liste2:
|
||||
resultat.append(tuple_1 + tuple_2)
|
||||
return resultat
|
||||
liste1, *reste = listes
|
||||
return produit_cartesien(liste1, produit_cartesien(*reste))
|
||||
|
||||
|
||||
liste1 = [(_,) for _ in range(3)]
|
||||
liste2 = [(_,) for _ in range(5)]
|
||||
liste3 = [(_,) for _ in range(8)]
|
||||
print(produit_cartesien(liste1, liste2))
|
||||
35
high-school/graphes/leaudibidon/main.py
Normal file
35
high-school/graphes/leaudibidon/main.py
Normal file
@@ -0,0 +1,35 @@
|
||||
class leaudibidon(object):
|
||||
|
||||
def __init__(self, capacity):
|
||||
self.capacity = capacity
|
||||
self.quantity = 0
|
||||
|
||||
def fullfill_b5(b5, b3):
|
||||
b5.quantity = b5.capacity
|
||||
print("Fullfill b5")
|
||||
|
||||
def fullfill_b3(b5, b3):
|
||||
b3.quantity = b3.capacity
|
||||
print("Fullfill b3")
|
||||
|
||||
def void_b5(b5, b3):
|
||||
b5.quantity = 0
|
||||
print("void b5")
|
||||
|
||||
def void_b3(b5, b3):
|
||||
b3.quantity = 0
|
||||
print("void b3")
|
||||
|
||||
def transfer_b5_b3(b5, b3):
|
||||
transfer_amount = min(b5.quantity, b3.capacity - b3.quantity)
|
||||
b5.quantity, b3.quantity = (
|
||||
b5.quantity - transfer_amount,
|
||||
b3.quantity + transfer_amount,
|
||||
)
|
||||
|
||||
def transfer_b3_b5(b5, b3):
|
||||
transfer_amount = min(b3.quantity, b5.capacity - b5.quantity)
|
||||
b5.quantity, b3.quantity = (
|
||||
b5.quantity + transfer_amount,
|
||||
b3.quantity - transfer_amount,
|
||||
)
|
||||
20
high-school/graphes/maze/fifo.py
Normal file
20
high-school/graphes/maze/fifo.py
Normal file
@@ -0,0 +1,20 @@
|
||||
class Pile:
|
||||
def __init__(self) -> None:
|
||||
self.element = []
|
||||
|
||||
def empiler(self, element) -> None:
|
||||
self.element.append(element)
|
||||
|
||||
def est_vide(self) -> bool:
|
||||
return len(self.element) == 0
|
||||
|
||||
def defiler(self):
|
||||
assert not self.est_vide(), "La pile est vide"
|
||||
return self.element.pop()
|
||||
|
||||
def size(self) -> int:
|
||||
return len(self.element)
|
||||
|
||||
def index(self, k):
|
||||
assert not self.est_vide(), "La pile est vide"
|
||||
return self.element[k]
|
||||
20
high-school/graphes/maze/lifo.py
Normal file
20
high-school/graphes/maze/lifo.py
Normal file
@@ -0,0 +1,20 @@
|
||||
class Queue:
|
||||
def __init__(self) -> None:
|
||||
self.element = []
|
||||
|
||||
def enfiler(self, element):
|
||||
self.element.append(element)
|
||||
|
||||
def est_vide(self):
|
||||
return len(self.element) == 0
|
||||
|
||||
def defiler(self):
|
||||
assert self.est_vide(), "La file est vide"
|
||||
return self.element.pop(0)
|
||||
|
||||
def size(self):
|
||||
return len(self.element)
|
||||
|
||||
def index(self, k):
|
||||
assert self.est_vide(), "La file est vide"
|
||||
return self.element[k]
|
||||
7
high-school/graphes/maze/main.py
Normal file
7
high-school/graphes/maze/main.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import maze_creator as mc
|
||||
|
||||
|
||||
lab = mc.Labyrinth(10, 10)
|
||||
lab.set_start_end((0, 0), (100, 100))
|
||||
lab.generate_maze()
|
||||
print(lab.__str__())
|
||||
78
high-school/graphes/maze/maze_creator.py
Normal file
78
high-school/graphes/maze/maze_creator.py
Normal file
@@ -0,0 +1,78 @@
|
||||
import random as rnd
|
||||
|
||||
|
||||
class Labyrinth:
|
||||
def __init__(self, rows, cols) -> None:
|
||||
self.rows = rows
|
||||
self.cols = cols
|
||||
# Grille initiale : 1 = mur, 0 = chemin
|
||||
self.grid = [[1 for _ in range(cols)] for _ in range(rows)]
|
||||
self.start = None
|
||||
self.end = None
|
||||
|
||||
def voisins(self, x, y):
|
||||
"""
|
||||
Retourne les voisins valides (encore des murs) de la cellule (x, y).
|
||||
"""
|
||||
directions = [(0, 2), (0, -2), (2, 0), (-2, 0)]
|
||||
voisins = []
|
||||
|
||||
for dx, dy in directions:
|
||||
nx, ny = x + dx, y + dy
|
||||
if 0 <= nx < self.rows and 0 <= ny < self.cols and self.grid[nx][ny] == 1:
|
||||
voisins.append((nx, ny))
|
||||
|
||||
return voisins
|
||||
|
||||
def casser_mur(self, x1, y1, x2, y2):
|
||||
"""
|
||||
Casse le mur entre les cellules (x1, y1) et (x2, y2).
|
||||
"""
|
||||
mx, my = (x1 + x2) // 2, (y1 + y2) // 2 # Coordonnées du mur à casser
|
||||
self.grid[mx][my] = 0 # Transformer le mur en chemin
|
||||
self.grid[x2][y2] = 0 # Transformer la cellule voisine en chemin
|
||||
|
||||
def generate_maze(self):
|
||||
"""
|
||||
Génère un labyrinthe parfait à l'aide de l'algorithme de Prim.
|
||||
"""
|
||||
# Choisir une cellule de départ aléatoire
|
||||
x, y = rnd.randrange(0, self.rows, 2), rnd.randrange(0, self.cols, 2)
|
||||
self.grid[x][y] = 0 # Transformer la cellule en chemin
|
||||
|
||||
# Liste des murs candidats (voisins de la cellule initiale)
|
||||
murs = self.voisins(x, y)
|
||||
|
||||
while murs:
|
||||
# Choisir un mur aléatoire
|
||||
nx, ny = rnd.choice(murs)
|
||||
murs.remove((nx, ny))
|
||||
|
||||
# Trouver une cellule voisine qui est déjà un chemin
|
||||
for dx, dy in [(-2, 0), (2, 0), (0, -2), (0, 2)]:
|
||||
cx, cy = nx + dx, ny + dy
|
||||
if (
|
||||
0 <= cx < self.rows
|
||||
and 0 <= cy < self.cols
|
||||
and self.grid[cx][cy] == 0
|
||||
):
|
||||
# Casser le mur entre les deux cellules
|
||||
self.casser_mur(cx, cy, nx, ny)
|
||||
# Ajouter les nouveaux murs adjacents
|
||||
murs.extend(self.voisins(nx, ny))
|
||||
break
|
||||
|
||||
def set_start_end(self, start, end):
|
||||
"""
|
||||
Définit les points de départ et d'arrivée du labyrinthe.
|
||||
"""
|
||||
self.start = start
|
||||
self.end = end
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""
|
||||
Représente le labyrinthe sous forme de chaîne de caractères.
|
||||
"""
|
||||
return "\n".join(
|
||||
"".join(" " if cell == 0 else "#" for cell in row) for row in self.grid
|
||||
)
|
||||
54
high-school/graphes/maze/test.py
Normal file
54
high-school/graphes/maze/test.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from fifo import (
|
||||
Pile,
|
||||
) # Remplacez "fifo" par le nom exact de votre fichier contenant la classe Pile
|
||||
|
||||
# Initialisation
|
||||
pile = Pile()
|
||||
|
||||
# Test de empiler
|
||||
pile.empiler(5)
|
||||
pile.empiler(10)
|
||||
assert pile.size() == 2, "Erreur : La taille de la pile devrait être 2"
|
||||
assert pile.element == [5, 10], "Erreur : Les éléments de la pile ne correspondent pas"
|
||||
|
||||
# Test de est_vide
|
||||
assert not pile.est_vide(), "Erreur : La pile ne devrait pas être vide"
|
||||
pile.defiler()
|
||||
pile.defiler()
|
||||
assert (
|
||||
pile.est_vide()
|
||||
), "Erreur : La pile devrait être vide après avoir défiler tous les éléments"
|
||||
|
||||
# Test de defiler
|
||||
pile.empiler(7)
|
||||
pile.empiler(3)
|
||||
assert pile.defiler() == 3, "Erreur : Le dernier élément défilé devrait être 3"
|
||||
assert pile.defiler() == 7, "Erreur : Le dernier élément défilé devrait être 7"
|
||||
try:
|
||||
pile.defiler()
|
||||
assert False, "Erreur : defiler devrait lever une exception pour une pile vide"
|
||||
except AssertionError as e:
|
||||
pass # Test réussi
|
||||
|
||||
# Test de size
|
||||
pile.empiler(4)
|
||||
assert pile.size() == 1, "Erreur : La taille de la pile devrait être 1"
|
||||
pile.defiler()
|
||||
assert pile.size() == 0, "Erreur : La taille de la pile devrait être 0 après defiler"
|
||||
|
||||
# Test de index
|
||||
pile.empiler(1)
|
||||
pile.empiler(2)
|
||||
pile.empiler(3)
|
||||
assert pile.index(0) == 1, "Erreur : L'élément à l'index 0 devrait être 1"
|
||||
assert pile.index(2) == 3, "Erreur : L'élément à l'index 2 devrait être 3"
|
||||
try:
|
||||
pile.defiler()
|
||||
pile.defiler()
|
||||
pile.defiler()
|
||||
pile.index(0)
|
||||
assert False, "Erreur : index devrait lever une exception pour une pile vide"
|
||||
except AssertionError as e:
|
||||
pass # Test réussi
|
||||
|
||||
print("Tous les tests sont passés avec succès !")
|
||||
111
high-school/graphes/monday_homework.py
Normal file
111
high-school/graphes/monday_homework.py
Normal file
@@ -0,0 +1,111 @@
|
||||
def construire_bfs(graphe: dict, origine: str) -> dict:
|
||||
"""
|
||||
Construit un arbre BFS à partir de graphe et d'un sommet d'origine.
|
||||
|
||||
Args:
|
||||
graphe (dict): Un dictionnaire représentant le graphe, où les clés sont les sommets et les valeurs sont des listes de sommets adjacents.
|
||||
origine (str): Le sommet de départ pour la recherche en largeur.
|
||||
|
||||
Returns:
|
||||
dict: Un dictionnaire représentant l'arbre BFS, où les clés sont les sommets et les valeurs sont des tuples contenant la distance depuis l'origine et le sommet precédent.
|
||||
|
||||
Examples:
|
||||
>>> graphe = {
|
||||
... '1': ['2', '3'],
|
||||
... '2': ['4', '5'],
|
||||
... '3': ['6'],
|
||||
... '4': [],
|
||||
... '5': ['6'],
|
||||
... '6': []
|
||||
... }
|
||||
>>> construire_bfs(graphe, '1')
|
||||
{'1': (0, None), '2': (1, '1'), '3': (1, '1'), '4': (2, '2'), '5': (2, '2'), '6': (2, '3')}
|
||||
|
||||
>>> graphe = {
|
||||
... 'A': ['B', 'C'],
|
||||
... 'B': ['D'],
|
||||
... 'C': ['E'],
|
||||
... 'D': [],
|
||||
... 'E': []
|
||||
... }
|
||||
>>> construire_bfs(graphe, 'A')
|
||||
{'A': (0, None), 'B': (1, 'A'), 'C': (1, 'A'), 'D': (2, 'B'), 'E': (2, 'C')}
|
||||
"""
|
||||
|
||||
couleur = dict()
|
||||
resultat = dict()
|
||||
for som in graphe.keys():
|
||||
couleur[som] = 0
|
||||
frontiere = [origine]
|
||||
resultat[origine] = (0, None)
|
||||
couleur[origine] = 1
|
||||
while len(frontiere) > 0:
|
||||
courant = frontiere.pop(0)
|
||||
longueur, precedent = resultat[courant]
|
||||
for som in graphe[courant]:
|
||||
if couleur[som] == 0:
|
||||
frontiere.append(som)
|
||||
resultat[som] = (longueur + 1, courant)
|
||||
couleur[som] = 1
|
||||
couleur[courant] = 2
|
||||
return resultat
|
||||
|
||||
|
||||
def construire_dfs(graphe: dict, origine: str) -> dict:
|
||||
"""
|
||||
Construit un arbre DFS à partir de graphe et d'un sommet d'origine.
|
||||
|
||||
Args:
|
||||
graphe (dict): Un dictionnaire représentant le graphe, où les clés sont les sommets et les valeurs sont des listes de sommets adjacents.
|
||||
origine (str): Le sommet de départ pour la recherche en profondeur.
|
||||
|
||||
Returns:
|
||||
dict: Un dictionnaire représentant l'arbre DFS.
|
||||
|
||||
Examples:
|
||||
>>> graphe = {
|
||||
... '1': ['2', '3'],
|
||||
... '2': ['4', '5'],
|
||||
... '3': ['6'],
|
||||
... '4': [],
|
||||
... '5': ['6'],
|
||||
... '6': []
|
||||
... }
|
||||
>>> construire_dfs(graphe, '1')
|
||||
{'1': (0, None), '2': (1, '1'), '3': (1, '1'), '6': (2, '3'), '4': (2, '2'), '5': (2, '2')}
|
||||
|
||||
>>> graphe = {
|
||||
... 'A': ['B', 'C'],
|
||||
... 'B': ['D'],
|
||||
... 'C': ['E'],
|
||||
... 'D': [],
|
||||
... 'E': []
|
||||
... }
|
||||
>>> construire_dfs(graphe, 'A')
|
||||
{'A': (0, None), 'B': (1, 'A'), 'C': (1, 'A'), 'E': (2, 'C'), 'D': (2, 'B')}
|
||||
"""
|
||||
|
||||
couleur = dict()
|
||||
resultat = dict()
|
||||
for som in graphe.keys():
|
||||
couleur[som] = 0
|
||||
frontiere = [origine]
|
||||
resultat[origine] = (0, None)
|
||||
couleur[origine] = 1
|
||||
while len(frontiere) > 0:
|
||||
courant = frontiere.pop()
|
||||
longueur, precedent = resultat[courant]
|
||||
for som in graphe[courant]:
|
||||
if couleur[som] == 0:
|
||||
frontiere.append(som)
|
||||
resultat[som] = (longueur + 1, courant)
|
||||
couleur[som] = 1
|
||||
couleur[courant] = 2
|
||||
return resultat
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod(verbose=True)
|
||||
print(construire_dfs(g, "1"))
|
||||
0
high-school/graphes/why
Normal file
0
high-school/graphes/why
Normal file
24
high-school/highlight.css
Normal file
24
high-school/highlight.css
Normal file
@@ -0,0 +1,24 @@
|
||||
/* Style definition file generated by highlight 4.13, http://andre-simon.de/ */
|
||||
/* highlight theme: Kwrite Editor */
|
||||
body.hl { background-color:#e0eaee; }
|
||||
pre.hl { color:#000000; background-color:#e0eaee; font-size:10pt; font-family:'Courier New',monospace; white-space: pre-wrap; }
|
||||
.hl.num { color:#b07e00; }
|
||||
.hl.esc { color:#ff00ff; }
|
||||
.hl.sng { color:#bf0303; }
|
||||
.hl.pps { color:#818100; }
|
||||
.hl.slc { color:#838183; font-style:italic; }
|
||||
.hl.com { color:#838183; font-style:italic; }
|
||||
.hl.ppc { color:#008200; }
|
||||
.hl.opt { color:#000000; }
|
||||
.hl.ipl { color:#0057ae; }
|
||||
.hl.lin { color:#555555; user-select: none;-webkit-user-select: none; }
|
||||
.hl.hvr { cursor:help; }
|
||||
.hl.erm { color:#ff0000; font-weight:bold; border:solid 1px red; margin-left: 3em; }
|
||||
.hl.err { color:#ff0000; font-weight:bold; }
|
||||
.hl.kwa { color:#000000; font-weight:bold; }
|
||||
.hl.kwb { color:#0057ae; }
|
||||
.hl.kwc { color:#000000; }
|
||||
.hl.kwd { color:#010181; }
|
||||
.hl.kwe { color:#0d5bc3; }
|
||||
.hl.kwf { color:#750dc3; }
|
||||
|
||||
12
high-school/magic_square/TDliste2liste/exercice1.py
Normal file
12
high-school/magic_square/TDliste2liste/exercice1.py
Normal file
@@ -0,0 +1,12 @@
|
||||
def appartient(elt, tableau):
|
||||
for i in tableau:
|
||||
if i == elt:
|
||||
return True
|
||||
else:
|
||||
continue
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(appartient(5, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
|
||||
print(appartient(5, [1, 2, 3, 4, 6, 7, 8, 9, 10]))
|
||||
23
high-school/magic_square/TDliste2liste/exercice2.py
Normal file
23
high-school/magic_square/TDliste2liste/exercice2.py
Normal file
@@ -0,0 +1,23 @@
|
||||
def max_local(tableau):
|
||||
maximum = tableau[0]
|
||||
for i in tableau:
|
||||
if i > maximum:
|
||||
maximum = i
|
||||
else:
|
||||
continue
|
||||
return maximum
|
||||
|
||||
|
||||
def indice_max(tableau):
|
||||
maximum = max_local(tableau)
|
||||
for i in range(len(tableau)):
|
||||
if tableau[i] == maximum:
|
||||
return i
|
||||
else:
|
||||
continue
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
l1 = [0, 2, 3, 4, 5, 6, 7, 8, 9, 90, 91, 59, 1]
|
||||
print(max_local(l1))
|
||||
print(indice_max(l1))
|
||||
11
high-school/magic_square/TDliste2liste/exercice3.py
Normal file
11
high-school/magic_square/TDliste2liste/exercice3.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def cree_tableau_n_m(n, m):
|
||||
return [[0 for _ in range(m)] for _ in range(n)]
|
||||
|
||||
|
||||
def cree_tableau_carre_n(n):
|
||||
return [[0 for _ in range(n)] for _ in range(n)]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(cree_tableau_n_m(3, 5))
|
||||
print(cree_tableau_carre_n(5))
|
||||
13
high-school/magic_square/TDliste2liste/exercice4.py
Normal file
13
high-school/magic_square/TDliste2liste/exercice4.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def cree_carre_entier_1_n_carre(n):
|
||||
carre = []
|
||||
compteur = 1
|
||||
for i in range(n):
|
||||
ligne = []
|
||||
for j in range(n):
|
||||
ligne.append(compteur)
|
||||
compteur += 1
|
||||
carre.append(ligne)
|
||||
return carre
|
||||
|
||||
|
||||
print(cree_carre_entier_1_n_carre(8))
|
||||
12
high-school/magic_square/TDliste2liste/exercice5.py
Normal file
12
high-school/magic_square/TDliste2liste/exercice5.py
Normal file
@@ -0,0 +1,12 @@
|
||||
def transpose(carre):
|
||||
n = len(carre) # Nombre de lignes (ou colonnes, car c'est une matrice carrée)
|
||||
return [[carre[j][i] for j in range(n)] for i in range(n)]
|
||||
|
||||
|
||||
def transpose_en_place(carre):
|
||||
n = len(carre) # Nombre de lignes (ou colonnes)
|
||||
for i in range(n):
|
||||
for j in range(
|
||||
i + 1, n
|
||||
): # Commencer à j = i + 1 pour éviter de réécrire les éléments déjà transposés
|
||||
carre[i][j], carre[j][i] = carre[j][i], carre[i][j] # Échange des éléments
|
||||
11
high-school/magic_square/TDliste2liste/exercice6.py
Normal file
11
high-school/magic_square/TDliste2liste/exercice6.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def diag_1(carre):
|
||||
return [carre[i][i] for i in range(len(carre))]
|
||||
|
||||
|
||||
def diag_2(carre):
|
||||
n = len(carre)
|
||||
return [carre[i][n - 1 - i] for i in range(n)]
|
||||
|
||||
|
||||
def colonne(j, carre):
|
||||
return [carre[i][j] for i in range(len(carre))]
|
||||
54
high-school/magic_square/magic_square.py
Normal file
54
high-school/magic_square/magic_square.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from TDliste2liste.exercice6 import diag_1, diag_2, colonne
|
||||
|
||||
|
||||
def check_diagonale(liste):
|
||||
return diag1(liste), diag2(liste)
|
||||
|
||||
|
||||
def check_colonne(liste):
|
||||
somme = []
|
||||
for i in range(len(liste)):
|
||||
somme.append(colonne(i, liste))
|
||||
return somme
|
||||
|
||||
|
||||
def check_line(liste):
|
||||
somme = []
|
||||
for i in range(len(liste)):
|
||||
somme.append(sum(liste[i]))
|
||||
return somme
|
||||
|
||||
|
||||
def check_all(carre):
|
||||
diag1_values, diag2_values = check_diagonale(carre)
|
||||
colonne_values = check_colonne(carre)
|
||||
line_values = check_line(carre)
|
||||
|
||||
# On récupère la première valeur de diag1 pour la comparaison
|
||||
reference_value = diag1_values[0] if diag1_values else None
|
||||
|
||||
# Vérification si toutes les valeurs sont les mêmes
|
||||
all_same = True
|
||||
|
||||
# Vérification des diagonales
|
||||
if not all(value == reference_value for value in diag1_values):
|
||||
all_same = False
|
||||
|
||||
if not all(value == reference_value for value in diag2_values):
|
||||
all_same = False
|
||||
|
||||
# Vérification des colonnes
|
||||
for col in colonne_values:
|
||||
if not all(value == reference_value for value in col):
|
||||
all_same = False
|
||||
|
||||
# Vérification des lignes
|
||||
for line in line_values:
|
||||
if line != reference_value:
|
||||
all_same = False
|
||||
|
||||
return all_same
|
||||
|
||||
|
||||
carre1 = [[4, 9, 2], [3, 5, 7], [8, 1, 6]]
|
||||
print(check_all(carre1))
|
||||
10
high-school/magic_square/td_carre_magique.py
Normal file
10
high-school/magic_square/td_carre_magique.py
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
carre1 = [[4, 9, 2], [3, 5, 7], [8, 1, 6]]
|
||||
carre2 = [[16, 9, 14], [11, 13, 15], [12, 17, 10]]
|
||||
carre3 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
||||
carre4 = [[16, 3, 2, 13], [5, 10, 11, 8], [9, 6, 7, 12], [4, 15, 14, 1]]
|
||||
carre5 = [[1, 14, 14, 4], [11, 7, 6, 9], [8, 10, 10, 5], [13, 2, 3, 15]]
|
||||
47
high-school/partition_fusion/code.py
Normal file
47
high-school/partition_fusion/code.py
Normal file
@@ -0,0 +1,47 @@
|
||||
def partition(tab, debut, fin):
|
||||
pivot = tab[fin]
|
||||
i = debut - 1
|
||||
for j in range(debut, fin):
|
||||
if tab[j] <= pivot:
|
||||
i += 1
|
||||
tab[i], tab[j] = tab[j], tab[i]
|
||||
tab[i + 1], tab[fin] = tab[fin], tab[i + 1]
|
||||
return i + 1
|
||||
|
||||
|
||||
def fusion(tab, debut, milieu, fin):
|
||||
gauche = tab[debut : milieu + 1]
|
||||
droite = tab[milieu + 1 : fin + 1]
|
||||
i, j, k = 0, 0, debut
|
||||
|
||||
while i < len(gauche) and j < len(droite):
|
||||
if gauche[i] <= droite[j]:
|
||||
tab[k] = gauche[i]
|
||||
i += 1
|
||||
else:
|
||||
tab[k] = droite[j]
|
||||
j += 1
|
||||
k += 1
|
||||
|
||||
while i < len(gauche):
|
||||
tab[k] = gauche[i]
|
||||
i += 1
|
||||
k += 1
|
||||
|
||||
while j < len(droite):
|
||||
tab[k] = droite[j]
|
||||
j += 1
|
||||
k += 1
|
||||
|
||||
|
||||
def tri_fusion_partition(tab, debut, fin):
|
||||
if debut < fin:
|
||||
pivot_index = partition(tab, debut, fin)
|
||||
tri_fusion_partition(tab, debut, pivot_index - 1)
|
||||
tri_fusion_partition(tab, pivot_index + 1, fin)
|
||||
fusion(tab, debut, pivot_index, fin)
|
||||
|
||||
|
||||
tableau = [34, 7, 23, 32, 5, 62, 32, 8, 9]
|
||||
tri_fusion_partition(tableau, 0, len(tableau) - 1)
|
||||
print("Tableau trié :", tableau)
|
||||
31
high-school/partition_fusion/code2.py
Normal file
31
high-school/partition_fusion/code2.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from random import shuffle
|
||||
|
||||
i = 0
|
||||
|
||||
|
||||
def fusion(liste_1, liste_2):
|
||||
global i
|
||||
if len(liste_1) == 0:
|
||||
return liste_2
|
||||
if len(liste_2) == 0:
|
||||
return liste_1
|
||||
if liste_1[0] <= liste_2[0]:
|
||||
i += 1
|
||||
return [liste_1[0]] + fusion(liste_1[1:], liste_2)
|
||||
i += 1
|
||||
return [liste_2[0]] + fusion(liste_1, liste_2[1:])
|
||||
|
||||
|
||||
def tri_pf(liste):
|
||||
global i
|
||||
if len(liste) <= 1:
|
||||
return liste
|
||||
i += 1
|
||||
millieu = len(liste) // 2
|
||||
return fusion(tri_pf(liste[:millieu]), tri_pf(liste[millieu:]))
|
||||
|
||||
|
||||
test = [23, 8, 20, 10, 13, 1]
|
||||
print(test, i)
|
||||
test = tri_pf(test)
|
||||
print(test, i)
|
||||
31
high-school/partition_fusion/liste.py
Normal file
31
high-school/partition_fusion/liste.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Mon Feb 10 09:15:57 2025
|
||||
|
||||
@author: elouan.fare
|
||||
"""
|
||||
|
||||
|
||||
def creer_liste():
|
||||
return ()
|
||||
|
||||
|
||||
def est_vide(liste):
|
||||
return len(liste) == 0
|
||||
|
||||
|
||||
def ajouter(liste, element):
|
||||
return (element, liste)
|
||||
|
||||
|
||||
def tete(liste):
|
||||
assert not (est_vide(liste)), "Liste vide"
|
||||
element, _ = liste
|
||||
return element
|
||||
|
||||
|
||||
def queue(liste):
|
||||
assert not (est_vide(liste)), "Liste vide"
|
||||
_, reste = liste
|
||||
return reste
|
||||
91
high-school/partition_fusion/partition_fusion.py
Normal file
91
high-school/partition_fusion/partition_fusion.py
Normal file
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Mon Feb 10 09:15:57 2025
|
||||
|
||||
@author: elouan.fare
|
||||
"""
|
||||
|
||||
|
||||
import liste as fifo
|
||||
|
||||
|
||||
def taille(liste):
|
||||
a = 0
|
||||
while not (fifo.est_vide(liste)):
|
||||
liste = fifo.queue(liste)
|
||||
a += 1
|
||||
return a
|
||||
|
||||
|
||||
def divise2(liste):
|
||||
n = taille(liste)
|
||||
droite, gauche = partition(liste, 0, n // 2)
|
||||
return droite, gauche
|
||||
|
||||
|
||||
def renverser(liste):
|
||||
result = fifo.creer_liste()
|
||||
while not fifo.est_vide(liste):
|
||||
result = fifo.ajouter(result, fifo.tete(liste))
|
||||
liste = fifo.queue(liste)
|
||||
return result
|
||||
|
||||
|
||||
def partition(liste, debut, fin):
|
||||
if fifo.est_vide(liste):
|
||||
return fifo.creer_liste(), fifo.creer_liste()
|
||||
|
||||
current = liste
|
||||
for _ in range(debut):
|
||||
if fifo.est_vide(current):
|
||||
break
|
||||
current = fifo.queue(current)
|
||||
|
||||
segment_inversé = fifo.creer_liste()
|
||||
for _ in range(fin - debut):
|
||||
if fifo.est_vide(current):
|
||||
break
|
||||
segment_inversé = fifo.ajouter(segment_inversé, fifo.tete(current))
|
||||
current = fifo.queue(current)
|
||||
|
||||
segment = renverser(segment_inversé)
|
||||
|
||||
return current, segment
|
||||
|
||||
|
||||
def fusion(gauche, droite):
|
||||
if fifo.est_vide(gauche):
|
||||
return droite
|
||||
if fifo.est_vide(droite):
|
||||
return gauche
|
||||
|
||||
if fifo.tete(gauche) <= fifo.tete(droite):
|
||||
return fifo.ajouter(fusion(fifo.queue(gauche), droite), fifo.tete(gauche))
|
||||
else:
|
||||
return fifo.ajouter(fusion(gauche, fifo.queue(droite)), fifo.tete(droite))
|
||||
|
||||
|
||||
def merge_sort(liste):
|
||||
|
||||
if fifo.est_vide(liste):
|
||||
return liste
|
||||
elif fifo.est_vide(fifo.queue(liste)):
|
||||
return liste # si elle ne contient que un elt
|
||||
gauche, droite = divise2(liste)
|
||||
|
||||
tri1 = merge_sort(gauche) # recursif
|
||||
tri2 = merge_sort(droite) # recursif
|
||||
|
||||
return fusion(tri1, tri2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
liste = fifo.creer_liste()
|
||||
for i in reversed(range(100)):
|
||||
liste = fifo.ajouter(liste, i)
|
||||
print(liste)
|
||||
|
||||
print("Après avoir trié la liste:")
|
||||
|
||||
print(merge_sort(liste))
|
||||
14
high-school/perfect_number/main.py
Normal file
14
high-school/perfect_number/main.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import math
|
||||
|
||||
|
||||
def find_diviseur(number):
|
||||
diviseurs = []
|
||||
limit = int(number / 2)
|
||||
for i in range(1, limit):
|
||||
if number % i == 0:
|
||||
diviseurs.append(i)
|
||||
return diviseurs
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(find_diviseur(15))
|
||||
0
high-school/prblm.txt
Normal file
0
high-school/prblm.txt
Normal file
51
high-school/preuve.md
Normal file
51
high-school/preuve.md
Normal file
@@ -0,0 +1,51 @@
|
||||
```plaintext
|
||||
maxi(liste)
|
||||
precondition: |liste| > 0
|
||||
Resultat <- liste[0]
|
||||
index <- 1
|
||||
while index < |liste|
|
||||
if liste[index] > Resultat
|
||||
Resultat <- liste[index]
|
||||
index <- index + 1
|
||||
Resultat
|
||||
```
|
||||
# Preuve de terminaison
|
||||
La terminaison est assuré par la présence d'un variant de boucle (séquence d'entier naturel). *ici*
|
||||
```plaintext
|
||||
|liste| - index
|
||||
```
|
||||
est un variant de boucles
|
||||
|
||||
|
||||
# Preuve de correction partielle
|
||||
La correction partielle est assuré par *l'invariant de boucle* ici Resultat contient la valeur du plus grand élément de la liste entre les indices 0 et index - 1 inclus.
|
||||
- Avant que le premier passage dans la boucle
|
||||
Resultat contient liste[0]
|
||||
index contient 1
|
||||
q est le plus grand élément de la liste sur [0; index-1 = 0]
|
||||
|
||||
- Si à l'entrée dans la boucle invariant OK
|
||||
resultat contient le maximum de la tranche de liste sur [0; index - 1]
|
||||
|
||||
## 1) Cas si liste[index] > Resultat
|
||||
alors Resultat <- liste[index]
|
||||
donc Resultat = max(liste[i])
|
||||
i € [0; index]
|
||||
|
||||
|
||||
## 2) Cas sinon liste[index]<= Resultat = max liste[i], i € [0;index - 1]
|
||||
resultat = max(liste[i]) = Resultat
|
||||
i € [0; index]
|
||||
-----
|
||||
index = index + 1
|
||||
|
||||
donc
|
||||
index = index - 1
|
||||
-----
|
||||
et
|
||||
-------- -----
|
||||
Resultat contient le maxi de liste sur [0; index -1]
|
||||
d'ou l'invariance
|
||||
# Conclusion
|
||||
l'algo se termine et, à la sortie, index = |liste|
|
||||
et resultat contient le maxi de liste entre les index et |liste| - 1
|
||||
190
high-school/programmation_dynamique/bag/main.py
Normal file
190
high-school/programmation_dynamique/bag/main.py
Normal file
@@ -0,0 +1,190 @@
|
||||
Videos = {
|
||||
"Video 1": {"Durée": 114, "Taille": 4.57},
|
||||
"Video 2": {"Durée": 32, "Taille": 0.63},
|
||||
"Video 3": {"Durée": 20, "Taille": 1.65},
|
||||
"Video 4": {"Durée": 4, "Taille": 0.085},
|
||||
"Video 5": {"Durée": 18, "Taille": 2.15},
|
||||
"Video 6": {"Durée": 80, "Taille": 2.71},
|
||||
"Video 7": {"Durée": 5, "Taille": 0.32},
|
||||
}
|
||||
|
||||
|
||||
def dico_vers_liste(dico: dict) -> list:
|
||||
"""
|
||||
Conversion d'un dictionnaire en liste.
|
||||
PARAM. :
|
||||
- dico : DICT, dictionnaire à applatir
|
||||
RESULT. :
|
||||
- LIST, chaque élément de la liste est un tuple (cle, valeur) du dictionnaire.
|
||||
PRECOND. :
|
||||
- aucune
|
||||
EFFET DE BORD :
|
||||
- aucun
|
||||
|
||||
"""
|
||||
return list(
|
||||
dico.items() # j'ai remplacer le code de base qui contenait Videos a la place de dico dans le return
|
||||
)
|
||||
|
||||
|
||||
def entier_vers_binaire(n: int, taille: int) -> list:
|
||||
"""
|
||||
Conversion d'un entier en binaire sur une taille donnée.
|
||||
PARAM. :
|
||||
- n : INT, le nombre à convertir
|
||||
- taille : INT, la taille (nb de bits) fixe de la représentation
|
||||
RESULT. :
|
||||
- LIST, la liste des bits de la représentation en binaire,
|
||||
indexée par le poids
|
||||
PRECONDITION :
|
||||
- n < 2**taille : un entier >= 2**taille n'est pas représentable
|
||||
dans la taille donnée
|
||||
EFFET DE BORD :
|
||||
- aucun
|
||||
"""
|
||||
assert 2**taille > n, "Taille de représentation trop petite"
|
||||
bits = [0] * taille
|
||||
for i in range(taille):
|
||||
bits[i] = (n >> i) & 1
|
||||
|
||||
return bits
|
||||
|
||||
|
||||
def ensemble_des_parties(ensemble: list):
|
||||
"""
|
||||
Construit l'itérable enumérant toutes les parties d'un ensemble.
|
||||
PARAM. :
|
||||
- ensemble : LIST, la liste des éléments de l'ensemble
|
||||
RESULT. :
|
||||
- ITERATOR, le générateur de toutes les parties de l'ensemble
|
||||
PRECONDITION :
|
||||
- aucune
|
||||
EFFET DE BORD :
|
||||
- aucun
|
||||
"""
|
||||
n = len(ensemble)
|
||||
for mask in range(2**n):
|
||||
partie = [ensemble[i] for i in range(n) if (mask >> i) & 1]
|
||||
yield partie
|
||||
|
||||
|
||||
def total_duree(partie):
|
||||
return sum(elt[1]["Durée"] for elt in partie)
|
||||
|
||||
|
||||
def total_taille(partie):
|
||||
return sum(elt[1]["Taille"] for elt in partie)
|
||||
|
||||
|
||||
def sac_a_dos_force_brute(videos, capacite):
|
||||
meilleur = ([], 0, 0.0)
|
||||
for partie in ensemble_des_parties(videos):
|
||||
taille = total_taille(partie)
|
||||
duree = total_duree(partie)
|
||||
if taille <= capacite and duree > meilleur[1]:
|
||||
meilleur = ([v[0] for v in partie], duree, taille)
|
||||
return meilleur
|
||||
|
||||
|
||||
# Glouton
|
||||
def sac_a_dos_glouton(videos, capacite, cle):
|
||||
tri = sorted(videos, key=cle, reverse=True)
|
||||
sélection = []
|
||||
totale_taille = 0.0
|
||||
totale_duree = 0
|
||||
for nom, info in tri:
|
||||
if totale_taille + info["Taille"] <= capacite:
|
||||
sélection.append(nom)
|
||||
totale_taille += info["Taille"]
|
||||
totale_duree += info["Durée"]
|
||||
return sélection, totale_duree, totale_taille
|
||||
|
||||
|
||||
"""def sac_a_dos_dynamique(videos, capacite):
|
||||
precision = 100
|
||||
capacite = int(capacite * precision)
|
||||
liste = list(videos.items())
|
||||
n = len(liste)
|
||||
dp = [[0] * (capacite + 1) for _ in range(n + 1)]
|
||||
for i in range(1, n + 1):
|
||||
nom, info = liste[i - 1]
|
||||
duree = info["Durée"]
|
||||
taille = int(info["taille"] * precision)
|
||||
for cap in range(capacite + 1):
|
||||
if taille <= cap:
|
||||
dp[i][cap] = max(dp[i - 1][cap], duree + dp[i - 1][cap - taille])
|
||||
else:
|
||||
dp[i][cap] = dp[i - 1][cap]
|
||||
cap = capacite
|
||||
selection = []
|
||||
for i in range(n, 0, -1):
|
||||
if dp[i][cap] != dp[i - 1][cap]:
|
||||
nom, info = liste[i - 1]
|
||||
selection.append(nom)
|
||||
cap -= int(info["taille"] * precision)
|
||||
return selection[::-1]"""
|
||||
|
||||
|
||||
def sac_a_dos_dyn(videos, cap):
|
||||
videos = [(d, int(t * 100)) for (d, t) in videos]
|
||||
capacite = int(cap * 100)
|
||||
n = len(videos)
|
||||
dp = [[0 for _ in range(capacite + 1)] for _ in range(n + 1)]
|
||||
for k in range(1, n + 1):
|
||||
duree_k, taille_k = videos[k - 1]
|
||||
for w in range(capacite + 1):
|
||||
if taille_k > w:
|
||||
dp[k][w] = dp[k - 1][w]
|
||||
else:
|
||||
dp[k][w] = max(dp[k - 1][w], duree_k + dp[k - 1][w - taille_k])
|
||||
|
||||
w = capacite
|
||||
choix = []
|
||||
for k in range(n, 0, -1):
|
||||
if dp[k][w] != dp[k - 1][w]:
|
||||
choix.append(k - 1)
|
||||
w -= videos[k - 1][1]
|
||||
|
||||
return dp[n][capacite], list(reversed(choix))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
liste_videos = dico_vers_liste(Videos)
|
||||
for video in liste_videos:
|
||||
print(video)
|
||||
opt_brut, dur_brut, taille_brut = sac_a_dos_force_brute(liste_videos, 5.0)
|
||||
print("--- Force brute ---")
|
||||
print(
|
||||
f"Vidéos : {opt_brut}\nDurée : {dur_brut} min\nTaille : {taille_brut:.3f} Go\n"
|
||||
)
|
||||
h_duree = lambda x: x[1]["Durée"]
|
||||
h_taille = lambda x: -x[1]["Taille"]
|
||||
h_ratio = lambda x: x[1]["Durée"] / x[1]["Taille"]
|
||||
selection_duree, dur_duree, taille_duree = sac_a_dos_glouton(
|
||||
liste_videos, 5.0, h_duree
|
||||
)
|
||||
selection_taille, dur_taille, taille_taille = sac_a_dos_glouton(
|
||||
liste_videos, 5.0, h_taille
|
||||
)
|
||||
selection_ratio, dur_ratio, taille_ratio = sac_a_dos_glouton(
|
||||
liste_videos, 5.0, h_ratio
|
||||
)
|
||||
print("--- Glouton par durée décroissante ---")
|
||||
print(
|
||||
f"Vidéos : {selection_duree}\nDurée : {dur_duree} min\nTaille : {taille_duree:.3f} Go\n"
|
||||
)
|
||||
print("--- Glouton par taille croissante ---")
|
||||
print(
|
||||
f"Vidéos : {selection_taille}\nDurée : {dur_taille} min\nTaille : {taille_taille:.3f} Go\n"
|
||||
)
|
||||
print("--- Glouton par ratio durée/taille ---")
|
||||
print(
|
||||
f"Vidéos : {selection_ratio}\nDurée : {dur_ratio} min\nTaille : {taille_ratio:.3f} Go\n"
|
||||
)
|
||||
videos_mb = [
|
||||
(nom, (info["Durée"], int(round(info["Taille"] * 1000))))
|
||||
for nom, info in liste_videos
|
||||
]
|
||||
capacite_mb = 5000
|
||||
n = len(videos_mb)
|
||||
dp = [[0] * (capacite_mb + 1) for _ in range(n + 1)]
|
||||
44
high-school/programmation_dynamique/bellman/main.py
Normal file
44
high-school/programmation_dynamique/bellman/main.py
Normal file
@@ -0,0 +1,44 @@
|
||||
def bellman(graphe, sommet):
|
||||
"""Une fonction qui prend en parametre un graphe et renvoie un dictionnaire contenant le cout des chemins de tous les points du graphe
|
||||
|
||||
Args:
|
||||
graphe (dict): dictionnaire
|
||||
sommet (str): le point de depart
|
||||
|
||||
Raises:
|
||||
ValueError: boucle infini (quand la comme des cout est negative)
|
||||
|
||||
Returns:
|
||||
dict: un dictionnaire contenant les couts
|
||||
>>> bellman({"A":[("B",3),("C",4)],"B":[("C",0)],"C":[]},"A")
|
||||
{'A': 0, 'B': 3, 'C': 3}
|
||||
"""
|
||||
distance = {sommet: float("inf") for sommet in graphe}
|
||||
distance[sommet] = 0
|
||||
|
||||
for i in range(len(graphe) - 1):
|
||||
for j in graphe:
|
||||
for k, coef in graphe[j]:
|
||||
if distance[j] + coef < distance[k]:
|
||||
distance[k] = distance[j] + coef
|
||||
|
||||
for j in graphe:
|
||||
for k, coef in graphe[j]:
|
||||
if distance[j] + coef < distance[k]:
|
||||
raise ValueError("Cycle infini (le valeurs deviennent de plus en plus petite vers -inf)")
|
||||
|
||||
return distance
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
doctest.testmod()
|
||||
graphe = {
|
||||
"A": [("G", 8), ("H", 4)],
|
||||
"G": [("H", 1), ("L", 2)],
|
||||
"H": [("L", 5), ("E", 7)],
|
||||
"L": [("E", 2)],
|
||||
"E": [],
|
||||
}
|
||||
distances = bellman(graphe, "A")
|
||||
print(distances)
|
||||
24
high-school/programmation_dynamique/monnaie/piece.py
Normal file
24
high-school/programmation_dynamique/monnaie/piece.py
Normal file
@@ -0,0 +1,24 @@
|
||||
def machine_bruteforce(price, enter, money_allowed):
|
||||
assert (
|
||||
enter >= price
|
||||
), "The entered amount must be greater than or equal to the price"
|
||||
change = enter - price
|
||||
if change == 0:
|
||||
return [[]]
|
||||
|
||||
results = []
|
||||
|
||||
def brute(current_combination, total):
|
||||
if total == change:
|
||||
results.append(current_combination.copy())
|
||||
return
|
||||
if total > change:
|
||||
return
|
||||
|
||||
for coin in money_allowed:
|
||||
current_combination.append(coin)
|
||||
brute(current_combination, total + coin)
|
||||
current_combination.pop()
|
||||
|
||||
brute([], 0)
|
||||
return results
|
||||
8
high-school/programmation_dynamique/monnaie/piece1.py
Normal file
8
high-school/programmation_dynamique/monnaie/piece1.py
Normal file
@@ -0,0 +1,8 @@
|
||||
def change_render(p, price, given_money):
|
||||
change = given_money - price
|
||||
if change < 0:
|
||||
raise Exception("the price cannot be greater than the given money")
|
||||
else:
|
||||
pos_m = [] # En gros ça donne les pièce inférieur au montant de change
|
||||
pos_m = sorted([i for i in p if i <= change])
|
||||
pos_t = []
|
||||
26
high-school/question_du_jour/05-05-2025/pro_dynamique.py
Normal file
26
high-school/question_du_jour/05-05-2025/pro_dynamique.py
Normal file
@@ -0,0 +1,26 @@
|
||||
pyramide = [["x"], ["y", "z"], ["a", "b", "c"]]
|
||||
# tableau triangulaire meilleur rendement avec un double boucle
|
||||
# exemple:
|
||||
# [1],[4,2],[9,7,3],[10,6,100,1]
|
||||
# meilleur chemin 100, 7, 4, 1 (on ne peut pas faire 100 9 4 1 car 100 et 9 sont eloigner d'une distance > 1 au niveau de l'abcisse dans les étages)
|
||||
|
||||
|
||||
def meilleur_rendement(pyramide: list[list[int]]):
|
||||
copie_l = [ligne for ligne in pyramide[::-1]]
|
||||
pyramide = pyramide[::-1]
|
||||
for i in range(1, len(pyramide)):
|
||||
for j in range(len(pyramide[i])):
|
||||
pyramide[i][j] += max(pyramide[i - 1][j], pyramide[i - 1][j + 1])
|
||||
return pyramide[-1][0]
|
||||
|
||||
|
||||
def print_pyramide(pyramide):
|
||||
for l in pyramide:
|
||||
print(f"{l}\n")
|
||||
return None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pyramide1 = [[1], [4, 2], [9, 7, 3], [10, 6, 100, 1]]
|
||||
print_pyramide(pyramide1[::-1])
|
||||
print(meilleur_rendement(pyramide1))
|
||||
20
high-school/question_du_jour/12-05-2025/main.py
Normal file
20
high-school/question_du_jour/12-05-2025/main.py
Normal file
@@ -0,0 +1,20 @@
|
||||
def force_brute(liste, i, j):
|
||||
summs = []
|
||||
for start in range(i, j):
|
||||
for end in range(start + 1, j + 1):
|
||||
summs.append(sum(liste[start:end]))
|
||||
return max(summs)
|
||||
|
||||
|
||||
def somme_max(liste):
|
||||
max_actuel = max_total = liste[0]
|
||||
for x in liste[1:]:
|
||||
max_actuel = max(x, max_actuel + x)
|
||||
max_total = max(max_total, max_actuel)
|
||||
return max_total
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
liste = [4, -1, -2, 5, -2]
|
||||
m = force_brute(liste, 0, 5)
|
||||
print(m)
|
||||
37
high-school/question_du_jour/19-05-2025/main.py
Normal file
37
high-school/question_du_jour/19-05-2025/main.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Trouver la plus grande séquence de caractère commune entre de listes ou string
|
||||
from random import randint
|
||||
if __name__ =="__main__":
|
||||
l1 = [randint(0,100) for _ in range(100)]
|
||||
l2 = [randint(0,100) for _ in range(100)]
|
||||
adef lcs(a, b):
|
||||
"""
|
||||
Renvoie la plus longue sous-séquence commune entre séquences a et b.
|
||||
"""
|
||||
n, m = len(a), len(b)
|
||||
dp = [[0] * (m + 1) for _ in range(n + 1)]
|
||||
for i in range(n):
|
||||
for j in range(m):
|
||||
if a[i] == b[j]:
|
||||
dp[i + 1][j + 1] = dp[i][j] + 1
|
||||
else:
|
||||
dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])
|
||||
i, j = n, m
|
||||
seq = []
|
||||
while i > 0 and j > 0:
|
||||
if a[i - 1] == b[j - 1]:
|
||||
seq.append(a[i - 1])
|
||||
i -= 1
|
||||
j -= 1
|
||||
elif dp[i - 1][j] >= dp[i][j - 1]:
|
||||
i -= 1
|
||||
else:
|
||||
j -= 1
|
||||
return seq[::-1]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from random import randint
|
||||
l1 = [randint(0, 100) for _ in range(100)]
|
||||
l2 = [randint(0, 100) for _ in range(100)]
|
||||
commun = lcs(l1, l2)
|
||||
print(commun)
|
||||
1
high-school/readme_creator.txt
Normal file
1
high-school/readme_creator.txt
Normal file
@@ -0,0 +1 @@
|
||||
➜ cours git:(main) tree | highlight --syntax=text --out-format=html > README.html
|
||||
13
high-school/recherche/main.py
Normal file
13
high-school/recherche/main.py
Normal file
@@ -0,0 +1,13 @@
|
||||
if __name__ == "__main__":
|
||||
liste1 = [12,1,20,5,23,8,29,10]
|
||||
liste2 = [23,5,19,11,18,20,29,1,5,10,8]
|
||||
|
||||
|
||||
def recherche(l1, l2):
|
||||
ln1 = len(l1)
|
||||
ln2 = len(l2)
|
||||
if ln1>ln2:
|
||||
for element in l2:
|
||||
t = True
|
||||
while t:
|
||||
b = l1[index(element)]
|
||||
36
high-school/recursivite/TD1.py
Normal file
36
high-school/recursivite/TD1.py
Normal file
@@ -0,0 +1,36 @@
|
||||
def factorielle(number: int):
|
||||
if number == 0:
|
||||
return 1
|
||||
else:
|
||||
return number * factorielle(number - 1)
|
||||
|
||||
|
||||
def modulo(a, b):
|
||||
if b - a < 0:
|
||||
return b
|
||||
elif b == 0:
|
||||
return b
|
||||
else:
|
||||
return modulo(a, b - a)
|
||||
|
||||
|
||||
def somme(n):
|
||||
if n == 0:
|
||||
return n
|
||||
else:
|
||||
return n + somme(n - 1)
|
||||
|
||||
|
||||
def init_quotient(a, b):
|
||||
i = 0
|
||||
return quotient(a, b, i)
|
||||
|
||||
|
||||
def quotient(a, b, i):
|
||||
if b == 0 or b - a < 0:
|
||||
return i
|
||||
else:
|
||||
return quotient(a, b - a, i + 1)
|
||||
|
||||
|
||||
print(init_quotient(6, 18))
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user