atelier

Python

parcours pratique pour apprendre Python depuis zero

definition d abord

ce que signifie Python

Python sert a ecrire des instructions precises. Ici tu l abordes comme parcours pratique pour apprendre Python depuis zero. Commence par une idee simple: des entrees passent par des etapes et deviennent une sortie.

infos minimalesfichier app.pyexecuter python app.pyhabitude apprends une petite piece de Python, tape un exemple minimal et execute-le
programme

une suite d instructions executees dans un ordre clair.

valeur et variable

une valeur est une donnee. Une variable est le nom qui la garde.

fonction

un petit travail nomme qui recoit une entree et produit un resultat.

environnement

Python 3 execute le code de app.py.

premier code lisible

Variables

names lists dictionaries strings
score = 40 + 2
print(score)
sortie 42

lignee du langage

arbre de Python

vois d ou vient Python, quels langages sont proches, et quoi apprendre ensuite.

racines
ABCCUnix tools
actuelPythonfamille scripting
famillefamille scripting
utile pour

utile pour parcours pratique pour apprendre Python depuis zero

parcours debutant

1lire une regle2prevoir la sortie3taper de memoire4lancer la verification5recommencer avec un changement

Banque de questions

Chercher puis pratiquer

Choisis une etape ou cherche dans la banque de ce langage puis ouvre l exercice.

18 resultats
Q 1ChoixEtape 1 definitions

Python question 1

Python question 1. Choisis l explication qui correspond le mieux a function definition.

Q 2ChoixEtape 1 definitions

Python question 2

Python question 2. Choisis l explication qui correspond le mieux a list append.

Q 3ChoixEtape 1 definitions

Python question 3

Python question 3. Choisis l explication qui correspond le mieux a dictionary access.

Q 4ChoixEtape 1 definitions

Python question 4

Python question 4. Choisis l explication qui correspond le mieux a for loop.

Q 5ChoixEtape 1 definitions

Python question 5

Python question 5. Choisis l explication qui correspond le mieux a function definition.

Q 6ChoixEtape 1 definitions

Python question 6

Python question 6. Choisis l explication qui correspond le mieux a list append.

Q 7ChoixEtape 1 definitions

Python question 7

Python question 7. Choisis l explication qui correspond le mieux a dictionary access.

Q 8ChoixEtape 1 definitions

Python question 8

Python question 8. Choisis l explication qui correspond le mieux a for loop.

Q 9ChoixEtape 1 definitions

Python question 9

Python question 9. Choisis l explication qui correspond le mieux a function definition.

Q 10ChoixEtape 1 definitions

Python question 10

Python question 10. Choisis l explication qui correspond le mieux a list append.

Q 11ChoixEtape 1 definitions

Python question 11

Python question 11. Choisis l explication qui correspond le mieux a dictionary access.

Q 12ChoixEtape 1 definitions

Python question 12

Python question 12. Choisis l explication qui correspond le mieux a for loop.

Q 13ChoixEtape 1 definitions

Python question 13

Python question 13. Choisis l explication qui correspond le mieux a function definition.

Q 14ChoixEtape 1 definitions

Python question 14

Python question 14. Choisis l explication qui correspond le mieux a list append.

Q 15ChoixEtape 1 definitions

Python question 15

Python question 15. Choisis l explication qui correspond le mieux a dictionary access.

Q 16ChoixEtape 1 definitions

Python question 16

Python question 16. Choisis l explication qui correspond le mieux a for loop.

Q 17ChoixEtape 1 definitions

Python question 17

Python question 17. Choisis l explication qui correspond le mieux a function definition.

Q 18ChoixEtape 1 definitions

Python question 18

Python question 18. Choisis l explication qui correspond le mieux a list append.

choix multiple

Python question 1

Q 1Choixnouveau

Python question 1. Choisis l explication qui correspond le mieux a function definition.

def add(a, b):
    return a + b

reference

modeles pour app.py

Python 3python app.py
rappel de memoirelis un point puis recris le sans regarder
suivre le codenote les valeurs ligne par ligne avant d executer
taper soi memecopie moins tape plus et corrige un petit bug

names lists dictionaries strings

Variables

score = 40 + 2
print(score)
  • Indentation matters
  • Use descriptive names
  • Print intermediate values

def parameters return

fonctions

def add(a, b):
    return a + b
print(add(2, 3))
  • Use def to name work
  • Indent the body
  • Return the result

for ranges lists dictionaries

Loops

for item in ["a", "b"]:
    print(item)
  • Loop over values directly
  • Use enumerate when index matters
  • Keep loop bodies short