Data Type And Variables In Python | Python In Hindi | Python Learning

Published: 08 June 2023
on channel: Anbody Can Code (Hindi)
1,556
8

Complete Python Introduction For Beginners In Hindi
   • Complete Python Introduction For Beginners...  

In Python, variables are used to store data values. They act as placeholders that can hold different types of data, such as numbers, strings, lists, or more complex objects. Variables allow you to manipulate and work with data in your programs.



The assigned value can be of a different data type from the original value.

python
Copy code
x = 10
x = "Hello"
Variable Scope:

Variables have a scope, which determines their accessibility within the program.
Variables defined inside a function are considered local to that function and cannot be accessed outside of it.
Variables defined outside of any function, typically at the top level of a script, have global scope and can be accessed from anywhere in the code.
These are some key aspects of Python variables. They provide flexibility in storing and manipulating data, and their dynamic nature makes Python a versatile language for various programming tasks.


Python has several built-in data types that are used to represent different kinds of values. Here are some of the commonly used data types in Python:
Numeric Types:

int: Represents integers, such as 5 or -10.
float: Represents floating-point numbers with decimal places, such as 3.14 or -2.5.
complex: Represents complex numbers with real and imaginary parts, such as 2 + 3j.
Sequence Types:

list: Ordered, mutable collection of elements, enclosed in square brackets ([]). Example: [1, 2, 3].
tuple: Ordered, immutable collection of elements, enclosed in parentheses (()). Example: (4, 5, 6).
str: Represents a string of characters, enclosed in quotes ('' or ""). Example: "Hello, World!".
Mapping Type:

dict: Represents a key-value mapping or associative array, enclosed in curly braces ({}). Example: {'name': 'John', 'age': 25}.
Set Types:

set: Represents an unordered collection of unique elements, enclosed in curly braces ({}). Example: {1, 2, 3}.
frozenset: An immutable version of a set.
Boolean Type:

bool: Represents either True or False, used for logical operations and control flow.
None Type:

None: Represents the absence of a value or a null value.
These are some of the fundamental data types in Python, and you can also create your own custom data types using classes and objects. Python is a dynamically typed language, so you don't need to explicitly declare the data type of a variable before using it. The interpreter determines the data type based on the value assigned to the variable.






Regenerate response


On this page of the site you can watch the video online Data Type And Variables In Python | Python In Hindi | Python Learning with a duration of hours minute second in good quality, which was uploaded by the user Anbody Can Code (Hindi) 08 June 2023, share the link with friends and acquaintances, this video has already been watched 1,556 times on youtube and it was liked by 8 viewers. Enjoy your viewing!