EC 121 : évaluation en contrôle continu

Durée : 1 heure
Tout document autorisé

Test de Cooper

Le Test de Cooper est un exercice standardisé conçu pour évaluer l’endurance cardiorespiratoire. Après un échauffement approprié, le participant court pendant 12 minutes en tentant de couvrir la plus grande distance possible. Le résultat obtenu offre une estimation de la capacité aérobie de l’individu.

Interprétation des résultats

distance (femmes) distance (hommes) interprétation
d ≥ 2700 d ≥ 2800 très bon
2200 ≤ d < 2700 2400 ≤ d < 2800 bon
1800 ≤ d < 2200 2200 ≤ d < 2400 moyen
1500 ≤ d < 1800 1600 ≤ d < 2200 mauvais
d < 1500 d < 1600 très mauvais

Exercice 1

Écrivez un script cooper.py qui affiche le résultat du test de Cooper en fonction du genre du participant et de la distance parcourue, exprimée en mètres.



####################
#                  #
#  Test de Cooper  #
#                  #
####################

Vous êtes une femme (F) ou un homme (H) ? H
Distance parcourue (m) ? 2500

Résultat : bon
Correction
print('\n\n')
print('####################')
print('#                  #')
print('#  Test de Cooper  #')
print('#                  #')
print('####################')
print('\n')

gender = input('Vous êtes une femme (F) ou un homme (H) ? ')
distance = float(input('Distance parcourue (m) ? '))

if gender == 'F': 
  if distance >= 2700:
      interpretation = 'très bon'
  elif distance >= 2200:
      interpretation = 'bon'
  elif distance >= 1800:
      interpretation = 'moyen'
  elif distance >= 1500:
      interpretation = 'mauvais'
  else:
      interpretation = 'très mauvais'
else:
  if distance >= 2800:
      interpretation = 'très bon'
  elif distance >= 2400:
      interpretation = 'bon'
  elif distance >= 2200:
      interpretation = 'moyen'
  elif distance >= 1600:
      interpretation = 'mauvais'
  else:
      interpretation = 'très mauvais'

print('\nRésultat :', interpretation)

D'après Léger et Mercier (1983), il est possible d'estimer la VO2max à partir de la vitesse moyenne v (km/h) à l'aide de la formule ci-dessous :

VO2max = 1,353 + 3,163v + 0,0122586v2

Exercice 2

Complétez votre script cooper.py afin de calculer la VO2max en fonction de la distance renseignée par le participant.



####################
#                  #
#  Test de Cooper  #
#                  #
####################

Vous êtes une femme (F) ou un homme (H) ? H
Distance parcourue (m) ? 2500

Résultat : bon

VO2max : 42.8 ml/kg/min
Correction
print('\n\n')
print('####################')
print('#                  #')
print('#  Test de Cooper  #')
print('#                  #')
print('####################')
print('\n')

gender = input('Vous êtes une femme (F) ou un homme (H) ? ')
distance = float(input('Distance parcourue (m) ? '))

if gender == 'F': 
  if distance >= 2700:
      interpretation = 'très bon'
  elif distance >= 2200:
      interpretation = 'bon'
  elif distance >= 1800:
      interpretation = 'moyen'
  elif distance >= 1500:
      interpretation = 'mauvais'
  else:
      interpretation = 'très mauvais'
else:
  if distance >= 2800:
      interpretation = 'très bon'
  elif distance >= 2400:
      interpretation = 'bon'
  elif distance >= 2200:
      interpretation = 'moyen'
  elif distance >= 1600:
      interpretation = 'mauvais'
  else:
      interpretation = 'très mauvais'

print('\nRésultat :', interpretation)

v = distance * 60 / 12000
vo2max = 1.353 + 3.163 * v + 0.0122586 * v**2

print('\nVO2max :', round(vo2max, 1), 'ml/kg/min')

Séjour à Poudlard

Le fichier Excel Hogwarts.xlsx recense les élèves de Poudlard en fonction de leur genre, leur année de naissance et leur maison.

Télécharger le fichier

Exercice 3

Écrivez un script slytherin.py qui affiche le nom de tous les élèves de la maison Serpentard (Slytherin).

Students of the Slytherin house:
1 Adrian Pucey
2 Blaise Zabini
3 Cassius Warrington
4 Daphne Greengrass
5 Draco Malfoy
6 Graham Montague
7 Graham Pritchard
8 Gregory Goyle
9 Harper
10 Lucian Bole
11 Malcolm Baddock
12 Marcus Flint
13 Miles Bletchley
14 Milicent Bullstroude
15 Millicent Bulstrode
16 Pansy Parkinson
17 Peregrine Derrick
18 Terrence Higgs
19 Theodore Nott
20 Urquhart
21 Vaisey
22 Vincent Crabbe
Correction
import pandas as pd

df = pd.read_excel('Hogwarts.xlsx')

print('Students of the Slytherin house:')
k = 1
for i in df.index:
  if df['house'][i] == 'Slytherin':
    print(k, df['name'][i])
    k = k +1

Exercice 4

Écrivez un script oldest.py qui affiche le nom et la maison de l'élève le plus âgé de Poudlard.

Cedric Diggory ( Hufflepuff )
Correction
import pandas as pd

df = pd.read_excel('Hogwarts.xlsx')

i = df['yearOfBirth'].idxmin()
print(df['name'][i], '(', df['house'][i], ')')

Exercice 5

Écrivez un script females.py qui affiche le pourcentage de femmes de la maison Gryffondor (Gryffindor).

Gryffindor house:
41 % of females
59 % of males
Correction
import pandas as pd

df = pd.read_excel('Hogwarts.xlsx')

students = 0
females = 0

for i in df.index:
  if df['house'][i] == 'Gryffindor':
    students += 1
    if df['gender'][i] == 'female':
      females += 1

female_percentage = round(females * 100 / students)

print('Gryffindor house:')
print(female_percentage, '% of females')
print(100 - female_percentage, '% of males')

IMC en NBA

Le fichier nba_players recense 479 joueurs de la NBA avec leurs données anthropométriques exprimées en unités anglo-saxonnes (pieds, pouces et livres).

Télécharger le fichier

Exercice 6

Écrivez un script bmi.py qui convertit les tailles et poids respectivement en m et kg afin de calculer l'IMC de chaque joueur pour en déduire la moyenne et l'écart-type.

Dans un premier temps, vous ajouterez trois nouvelles colonnes au tableau des joueurs : height, weight et bmi.

BMI: 24 ± 2
Correction
import pandas as pd

player = pd.read_excel('nba_players.xlsx')

for k in player.index:
    player.loc[k, 'height'] = round(player['height_feet'][k] * 0.3048 + player['height_inches'][k] * 0.0254, 2)
    player.loc[k, 'weight'] = round(player['weight_pounds'][k] * 0.4535924)
    player.loc[k, 'bmi'] = player.loc[k, 'weight'] / player.loc[k, 'height']**2
    
player.to_excel('nba_players_converted.xlsx')

print('BMI:', round(player['bmi'].mean()), '±', round(player['bmi'].std()))

Exercice 7

Écrivez un script tallest.py qui affiche le nom du plus grand joueur des Boston Celtics.

Tallest Boston Celtics player: Kristaps Porzingis 2.21 m
Correction
import pandas as pd

player = pd.read_excel('nba_players_converted.xlsx')

max_height = 1
max_height_index = 1
for k in player.index:
  if player['team'][k] == 'Boston Celtics' and player['height'][k] > max_height:
    max_height = player['height'][k]
    max_height_index = k

# Alternative solution:
# max_height_index = player[ player['team'] == 'Boston Celtics' ]['height'].idxmax()
    
print('Tallest Boston Celtics player:', player['firstname'][max_height_index], player['lastname'][max_height_index], player['height'][max_height_index], 'm')