• Aucun résultat trouvé

return 0.57

N/A
N/A
Protected

Academic year: 2022

Partager "return 0.57"

Copied!
1
0
0

Texte intégral

(1)

TS 7 DST 2 correction 16 octobre 2014

Exercice 1 : —

Le signe est 0 donc c’est un nombre positif.

— La partie exposant est 10001000 donc 136 en d´ecimal, en retranchant 127 on obtient 9.

— La mantisse est le reste, c’est `a dire 1,1001 ou en d´ecimal 1+1/2+1/16 = 1,52625.

On obtient donc le nombre :

1,52625×29= 800.

Exercice 2 :

(1) Six= 4, on obtient l’affichageGagne puisx vaut 4 puisx different de 4 (attention `a l’indentation)

Si x=−1, on obtient l’affichageperdupuisx different de 4 (2) Six=−2 on obtient l’affichagex est negatif

Si x= 4 on obtient l’affichatex est positif Si x= 0 on obtient l’affichagex est positif

Exercice 3 :

On utilise la fonction suivante :

1

def tarif poste ( type , poids ):

2

if type == " verte ":

3

if poids == " 20 ":

4

return 0.57

5

elif poids == " 50 ":

6

return 0.95:

7

else :

8

return 1.40

9

elif type == " prioritaire "

10

if poids == " 20 ":

11

return 0.6

12

elif poids == " 50 ":

13

return 1:

14

else :

15

return 1.45

16

else :

17

if poids == " 20 ":

18

return 0.55

19

elif poids == " 50 ":

20

return 0.78:

21

else :

22

return 1

Exercice 4 :

(1) Il manque l’initialisation de la boucle. Entre la ligne 2 et 3, on doit rajouter i

= 0 (2)

1

def factorielle (n ):

2

a = 1

3

for i in range (n ):

4

a = a

i

5

return a

Exercice 5 :

(1) La fonction renvoie 9.

(2) Cette fonction calcule le maximum de la liste.

(3) On utilise la fonction :

1

def max (L ):

2

tmp = L [0]

3

indice = 0

4

longueur = len (L)

5

for i in range( longueur ):

6

if tmp

<

L[i ]:

7

tmp = L[i]

8

indice = i

9

return indice

Exercice 6 :

1

def max(L ):

2

tmp = L [0]

3

indice = 0

4

longueur = len (L)

5

for i in range ( longueur ):

6

if tmp

<

L[i ]:

7

tmp = L[i]

8

indice = i

9

return indice

Exercice 7 :

1

def Somme (L ):

2

somme = 0

3

longueur = len (L)

4

for i in range ( longueur ):

5

somme = L[i] + somme

6

return somme

Références

Documents relatifs

Reste à se rappeler que len(A) renvoie le nombre de lignes d’une matrice numpy, qui correspond donc à la taille de la matrice lorsqu’elle est carrée, et que A[:,j] permet

This non-negative functional tF was shown to be lower semi-continuous on the set of Lipschitz functions with the 1: I topology and hence could be extended to

On peut en effet dd- terminer les dites conditions par une extension tr~s facile ~t effectuer des considerations employ6es par ABEL daBs ses deux M6moires&#34;

Si nous nous reportons aux r~sultats contenus dans notre travail relatif aux formes quadrilin6aires, nous verrons ais~ment que la condition A -~ o, entraine

[r]

[r]

Naturally we can select the sequence (m)to be increasing. Therefore the compatibility condition has to be replaced by the following assertion:.. As one would guess.

Moti- vated by this observation we shall discuss the notion of an approximate limit in Section 6 and prove that a function satisfying the uniform Harnack