Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

Learn Python Data Types



Python has various data types to store different kinds of data. Understanding these data types is fundamental to programming in Python. Here’s an overview of the most commonly used data types in Python.


1. Numeric Types

Numeric types store numbers. Python supports integers, floating-point numbers, and complex numbers.

Example-
x = 5
y = 3.14
z = 1 + 2j
print(type(x))
print(type(y))
print(type(z))

2. Sequence Types

Sequence types store multiple items in an ordered manner. The three main sequence types are strings, lists, and tuples.

Examples:

Example-
string = "Hello, World!"
my_list = [1, 2, 3, 4, 5]
my_tuple = (1, 2, 3, 4, 5)
print(type(string))
print(type(my_list))
print(type(my_tuple))

3. Mapping Type

Mapping types store data in key-value pairs. The primary mapping type in Python is the dictionary.

Examples:

Example-
my_dict = {"name": "Alice", "age": 25, "city": "New York"}

print(type(my_dict))
print(my_dict)



Advertisement





it pathshaala : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java