python:openclassrooms
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| python:openclassrooms [2020/05/04 22:02] – created carl | python:openclassrooms [2020/07/10 12:39] (current) – carl | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| Pour lancer l' | Pour lancer l' | ||
| - | < | + | < |
| + | |||
| + | Pour affecter une valeur à une variable: | ||
| + | < | ||
| + | num = 7.2 | ||
| + | </ | ||
| + | |||
| + | Pour vérifier le type d'une variable : | ||
| + | < | ||
| + | |||
| + | Pour afficher : | ||
| + | < | ||
| + | |||
| + | Pour demander à l' | ||
| + | < | ||
| + | |||
| + | Conditions : if, elif, else. | ||
| + | |||
| + | La fonction modulo = % : | ||
| + | < | ||
| + | a = int(y) | ||
| + | if a % 400 == 0: | ||
| + | print(a, " est bissextile" | ||
| + | elif a % 4 != 0 or a % 100 == 0: | ||
| + | print(a, " n'est pas bissextile" | ||
| + | else: | ||
| + | print (a, " est bissextile" | ||
| + | |||
| + | Les boucles : while et for : | ||
| + | < | ||
| + | while i < 10: | ||
| + | print i+1 | ||
| + | i += 1 # i = i + 1 | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | for letter in mot: | ||
| + | print letter | ||
| + | </ | ||
python/openclassrooms.1588629747.txt.gz · Last modified: by carl
