22-04-2019, 12:13 AM
On a ceci
![[Image: ech1.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech1.png)
Et on voudrait ceci
![[Image: ech2.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech2.png)
Comment faire..?
C'est comme "comment échanger le contenu de 2 verres d'eau..?" : il faut un 3e verre..!
On crée donc une 3e variable C
![[Image: ech3.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech3.png)
> C prend la valeur A
![[Image: ech4.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech4.png)
> A prend la valeur B
![[Image: ech5.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech5.png)
> B prend la valeur C
![[Image: ech6.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech6.png)
![[Image: ech8.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech8.png)
![[Image: ech1.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech1.png)
Et on voudrait ceci
![[Image: ech2.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech2.png)
Comment faire..?
C'est comme "comment échanger le contenu de 2 verres d'eau..?" : il faut un 3e verre..!
On crée donc une 3e variable C
![[Image: ech3.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech3.png)
> C prend la valeur A
![[Image: ech4.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech4.png)
> A prend la valeur B
![[Image: ech5.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech5.png)
> B prend la valeur C
![[Image: ech6.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech6.png)
![[Image: ech7.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech7.png)
![[Image: ech8.png]](http://mathsbidouille.free.fr/ImagesForumMathsBi/python/ech8.png)