Corporate Training
Request Demo
Click me
Menu
Let's Talk
Request Demo

Tutorials

Variables and Data Types

Variables and Data Types

1. Variables and Naming Conventions:

  • What are variables and why are they used?
  • Rules for naming variables (must start with a letter, no spaces, etc.).
  • Choosing meaningful variable names. Variable assignment and reassignment.
  • Variable assignment and reassignment.

2. Numeric Data Types:

  • Integers (int): Whole numbers without decimals.
  • Floating-point numbers (float): Numbers with decimal points.
  • Complex numbers (complex): Numbers with real and imaginary parts.

3. Textual Data Type - Strings:

  • Creating strings using single, double, or triple quotes.
  • Escaping characters within strings.
  • String concatenation using the + operator.
  • String repetition using the * operator.
  • Accessing characters in a string using indexing.
  • Slicing strings to extract substrings.
  • String methods (.lower(), .upper(), .strip(), .replace(), etc.).

4. Boolean Data Type:

  • Boolean values (True and False).
  • Boolean operators (and, or, not).
  • Comparison operators (==, !=, <, >, <=, >=).

5. Type Conversion (Casting):

  • Converting between different data types (e.g., int to float, float to int).
  • Using built-in functions like int(), float(), str().

6. Type Inference:

  • Python's ability to automatically determine variable types.
  • Checking the type of a variable using the type() function.

7. None Type:

  • Understanding the special value None and its purpose.
  • Using None to indicate the absence of a value.

8. Mutable vs. Immutable Types:

  • Explaining the difference between mutable and immutable data types.
  • Lists as mutable and strings as immutable examples.

9. Type Checking and isinstance():

  • Checking the type of a variable using isinstance().
  • Handling different types of data differently in your code.

10. Variables and Memory Allocation:

  • How variables store references to objects in memory.
  • The concept of garbage collection.

11. Arithmetic Operations:

  • Performing arithmetic operations on numeric types.
  • Operator precedence and parentheses.

12. String Escapes and Raw Strings:

  • Special characters in strings (\n, \t, etc.).
  • Raw strings and their usage.

13. Unicode and Encoding:

  • Brief introduction to Unicode and character encoding.
  • Handling Unicode characters in strings.

14. Variables and Scope:

  • Local and global variables.
  • Scope rules within functions and code blocks.

15. Constants:

  • Creating constants using uppercase variable names.
  • Convention for indicating that a variable is a constant.