Introduction à Python pour les développeurs
Jasmin Ludolf
Senior Data Science Content Developer
$$
$$
$$
new_ingredient_quantity = 1.5
$$
$$
is_in_stock = True
is_in_stock = False
type()
Chaîne
ingredient_name = "tomatoes"print(type(ingredient_name))
<class 'str'>
Entier
ingredient_quantity = 2print(type(ingredient_quantity))
<class 'int'>
Flottant
new_ingredient_quantity = 1.5print(type(new_ingredient_quantity))
<class 'float'>
Booléen
is_in_stock = Trueprint(type(is_in_stock))
<class 'bool'>
type() pour identifier le type
Opérateurs arithmétiques :
+ pour addition- pour soustraction* pour multiplication/ pour divisionChiffres :
print(2 + 1.5)
3.5
Chaînes :
+ et * fonctionnent"Hi" + "There" = "HiThere"
"Hi" * 3 = "HiHiHi"
Introduction à Python pour les développeurs