solving 1st exercise
This commit is contained in:
parent
560099780c
commit
391433d018
1 changed files with 19 additions and 2 deletions
|
@ -35,7 +35,7 @@ def file_pleine(file):
|
|||
|
||||
def ajout_fin_file(file, elt):
|
||||
mail = Maillon(valeur=elt, suivant=None)
|
||||
if file.fin != None:
|
||||
if file.fin:
|
||||
file.fin.suivant = mail
|
||||
else:
|
||||
file.debut = mail
|
||||
|
@ -53,4 +53,21 @@ def retirer_debut_file(file):
|
|||
```
|
||||
|
||||
### Définition (tableaux)
|
||||
`TODO : Implémenter ça pour le 1/02`
|
||||
`TODO : Implémenter ça pour le 1/02`
|
||||
|
||||
## Exercices
|
||||
### Exercice 1
|
||||
Écrire un algo qui affiche les éléments d'une file en la conservant.
|
||||
|
||||
```python
|
||||
def affiche_file(f):
|
||||
f_temp = creer_file()
|
||||
|
||||
while !file_vide(f):
|
||||
print(debut_file(f))
|
||||
ajouter_fin_file(f_temp, debut_file(f))
|
||||
retirer_debut_file(f)
|
||||
|
||||
f = f_temp
|
||||
return f
|
||||
```
|
Loading…
Reference in a new issue