Formation
90 min read
Introduction to Python
π¦ Variables and Data Types
Learning objectives
π― Objectives:\n
1Understand variables\n2. Master types (int, float, str, bool)\n3. Use operators\n4. Convert types
Introduction
π This course explores variables and fundamental data types.
Theoretical content
Variables:\n
PYTHON
\nage = 25\nprice = 19.99\nname = "Jean"\nPractical examples
π» Example: BMI Calculator\n
PYTHON
\nweight = float(input("Weight: "))\nheight = float(input("Height: "))\nbmi = weight / (height ** 2)\nprint(f"BMI: {bmi:.2f}")\nBest practices
1Descriptive variable names\nβ
2. Snake_case convention\nβ
3. UPPERCASE for constants
Common pitfalls
Too short names\n
Explicit names
Summary
Variables: data containers\nβ
Types: int, float, str, bool\nβ
Operators: +, -, , /, //, %, *
Additional resources
π docs.python.org/3/tutorial/introduction.html