Aller au contenu principal
🔒 Mode aperçu. Les quinze premières leçons Foundations sont gratuites ; celle-ci est Pro. Démarrez un trial de 7 jours pour débloquer l'éditeur, les conseils AI et le reste du programme. Carte requise, annulez à tout moment dans Dashboard.Démarrer le trial de 7 jours →
⚡
← Cours›Python FoundationsModule 7 · Bibliothèque standard avancée›subprocess.run - prédire la sortiepredict140 / 174
+100 XP
Tâche🌐 shown in EN
📝 **Task:** Predict the two lines printed by the program. \`echo "hi"\` prints "hi" + newline (stripped) and exits 0. 📋 Edit the starter code below. Tests run automatically. 💡 **Hint:** Re-read the theory if you get stuck.
Prédis la sortie

Lis le code attentivement

import subprocess

result = subprocess.run(
    ["echo", "hi"],
    capture_output=True,
    text=True,
    check=True,
)
print(result.stdout.strip())
print(result.returncode)

Que va afficher le programme ? Écris ici :