Skip to content
Snippets Groups Projects
Commit 274b0845 authored by WITTMANN Gregory's avatar WITTMANN Gregory
Browse files

Add

parent 6f8c9bc7
No related branches found
No related tags found
No related merge requests found
# Ignore les fichiers et répertoires générés par Python
__pycache__/
*.pyc
*.pyo
*.pyd
# ignore les fichier txt
*.txt
# Ignore les fichiers générés par l'IDE (par exemple, PyCharm)
.idea/
# Ignore les fichiers générés lors de l'exécution des tests
htmlcov/
.coverage
# Ignore les fichiers générés par le système d'exploitation
.DS_Store
Thumbs.db
# Ignore les fichiers générés lors de la construction
dist/
build/
*.egg-info/
# Ignore les fichiers générés par les outils de gestion de dépendances
venv/
env/
stages:
- lint
- test
- build
variables:
PYTEST_FLAGS: "-v"
lint:
stage: lint
script:
- pip install flake8
- flake8 sphère.py
test:
stage: test
script:
- pip install -r requirements.txt
- pip install pytest
- pytest test_sphère.py
build:
stage: build
script:
- docker build -t EvalSpherePython .
\ No newline at end of file
# sphère.py
import math
......@@ -10,12 +11,14 @@ def calculer_volume_sphere(rayon):
def enregistrer_resultat_fichier(volume, fichier):
with open(fichier, 'w') as f:
f.write(f"Volume de la sphère : {volume}")
f.write(f"{volume}")
def main():
rayon = float(input("Rayon de la sphere : "))
rayon = float(input("Rayon de la sphère en cm : "))
volume = calculer_volume_sphere(rayon)
enregistrer_resultat_fichier(volume, "volume.txt")
# Enregistrement du résultat dans un fichier texte
enregistrer_resultat_fichier(volume, "volume.txt")
if __name__ == '__main__':
main()
\ No newline at end of file
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Résultat du Calcul</title>
</head>
<body>
<?php
// Lire le contenu du fichier texte
$contenu = file_get_contents('volume.txt');
// Afficher le contenu du fichier texte
echo '<p>Le volume du cône est de ' . $contenu . ' cm<sup>3</sup>.</p>';
?>
</body>
</html>
\ No newline at end of file
Volume de la sphère : 523.5987755982989
\ No newline at end of file
33.510321638291124
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment