Formation 90 min read Introduction to Python

πŸ“¦ Variables and Data Types

Python & Data Science Chapter : Introduction to Python Sub-chapter : 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"\n

Practical examples

πŸ’» Example: BMI Calculator\n
PYTHON
\nweight = float(input("Weight: "))\nheight = float(input("Height: "))\nbmi = weight / (height ** 2)\nprint(f"BMI: {bmi:.2f}")\n

Best 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