top of page

PYTHON FULL STACK ROADMAP 2024: Variables and Data Types (2)

Variables and Data Types:


1. Integers (int):

Integers are whole numbers, positive or negative, without decimals.


2. Floating-point numbers (float):

Floats are numbers with a decimal point.


3. Strings (str):

Strings are sequences of characters enclosed in single, double, or triple quotes.

4. Lists (list):

Lists are ordered collections of items (of any type), enclosed in square brackets.

5. Tuples (tuple):

Tuples are ordered collections of items (of any type), enclosed in parentheses, and are immutable.


6. Sets (set):

Sets are unordered collections of unique items, enclosed in curly braces.


7. Dictionaries (dict):

Dictionaries are collections of key-value pairs, enclosed in curly braces.

8. Boolean (bool):

Booleans represent one of two values: True or False.


Type Checking and Type Conversion

Type Checking:

You can check the type of a variable using the type() function.

Type Conversion:

You can convert between types using built-in functions like int(), float(), str(), etc.

These examples cover the basics of variables and data types in Python, providing a good starting point for understanding how to work with different kinds of data in your programs.

1 view0 comments

Comments


  • Instagram
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
bottom of page