Afficher
print("Bonjour tout le monde !")
prenom = "Léa"
age = 34
print("Je m'appelle", prenom, "et j'ai", age, "ans.")Lancer : python bonjour.py (Windows) ou python3 bonjour.py (Linux, Mac).
Demander
prenom = input("Ton prénom ? ")
annee = int(input("Ton année de naissance ? "))
print(f"Salut {prenom}, tu as environ {2026 - annee} ans.")
Les types de base
str: texte ("Léa")int/float: nombres (34,1.75)bool:True/False
Installer Python : sur Windows. Suite : les conditions.