From 4cf2adfd9e1c6daf50a736d45c51118420839aa7 Mon Sep 17 00:00:00 2001 From: mahmoudrabia Date: Tue, 3 Sep 2024 15:52:08 +0200 Subject: [PATCH] first session --- exe2,3.py | 16 ++++++++++++++++ exercice2,2.py | 16 ++++++++++++++++ exercice2.1.py | 19 +++++++++++++++++++ 3 files changed, 51 insertions(+), 0 deletions(-) create mode 100644 exe2,3.py create mode 100644 exercice2,2.py create mode 100644 exercice2.1.py diff --git a/exe2,3.py b/exe2,3.py new file mode 100644 index 0000000..79843a2 --- /dev/null +++ b/exe2,3.py @@ -0,0 +1,16 @@ +r = 3 +x=0,5; +f=(r+1)*x-r*(x*x); +def f1(x): + f1=(r+1)*x-r*(x*x); + +i = 0; +for i in range(0,500): + f1(x) + x= f1(x); + + +print(x) + +#exo2.4 +# on va sortir de la boucle avant de tester est ce qu'elle egale a 0 \ No newline at end of file diff --git a/exercice2,2.py b/exercice2,2.py new file mode 100644 index 0000000..ab7ac08 --- /dev/null +++ b/exercice2,2.py @@ -0,0 +1,16 @@ +z = (3.11*2.3)*1.5; +y = 3.11*(2.3*1.5); +print(z) +print(y) +#we expcet the same result +# we got 10.7295 , 10.729499999999998 c'est pas le meme rendu + +o = 1.11+(3.33+5.50); +p = (1.11+3.33)+5.50; +print(o); +print(p); +# le meme resultat pour les deux operations +# 9.94 9.940000000000001 , c'est pas la meme precision pour les deux resultats + + + diff --git a/exercice2.1.py b/exercice2.1.py new file mode 100644 index 0000000..e128e23 --- /dev/null +++ b/exercice2.1.py @@ -0,0 +1,19 @@ +#0.1 est non representable +x= 0.1 ; +print(x) +print("% .25f" %x) + +y=0.2; +z= x+y; +print(z) +#0.3 +#.30000000000000004 + #laprecision est beaucoup mieux + #s qu'on a des calculs complexe la merge d'erreur augmante plus de zero# +p=2.675; +print(round(p,2)) + +#2.85 + + + \ No newline at end of file -- libgit2 0.21.2