Data Types of Python :

There are several types of Built-in data types in Python.

1. Numeric Type : 

Numeric types include integers, floats, and complex numbers. Integers are whole numbers, floats are decimal numbers, and complex numbers are numbers with a real and imaginary part.

2. Boolean Type : 

The Boolean type represents truth values, which can be either True or False.

3. Sequence Types 

Sequence types include strings, lists, and tuples. Strings are sequences of characters, while lists and tuples are sequences of values of any data type.

4. Mapping Type 

The mapping type is represented by dictionaries, which are collections of key-value pairs.

5. Set Types

Set types include sets and frozensets. Sets are unordered collections of unique values, while frozensets are immutable sets.


Small Code related to Data Types is below :


# Numeric Types my_int = 42 my_float = 3.14 my_complex = 2 + 3j # Boolean Type my_bool = True # Sequence Types my_string = "Hello, World!" my_list = [1, 2, 3] my_tuple = (4, 5, 6) # Mapping Type my_dict = {"name": "John", "age": 30} # Set Types my_set = {1, 2, 3} my_frozenset = frozenset({4, 5, 6})


Comments

Popular posts from this blog

About RAM

Class and object in c++