✨️✨️Understanding Data Types and Operators✨️✨️
Hi everyone! 👋
Here's what I learned 👇
🔢 What are Data Types?
Data types define the kind of data we are working with in a program or dataset.
👉 Common Data Types:
Integer (int) – Whole numbers (e.g., 10, -5)
Float (float) – Decimal numbers (e.g., 3.14, -0.01)
String (str) – Text (e.g., "Hello", "Ramya")
Boolean (bool) – True or False values
List – Ordered, changeable collection (e.g., [1, 2, 3])
Tuple – Ordered, unchangeable collection (e.g., (1, 2, 3))
Dictionary (dict) – Key-value pairs (e.g., {"name": "Ramya", "age": 21})
➕ What are Operators?
Operators are symbols that perform operations on variables and values.
🧮 Types of Operators:
Arithmetic Operators
Perform basic math:
Addition
Subtraction
Multiplication
/ Division
% Modulus (remainder)
** Exponent (power)
// Floor division
Comparison Operators
Compare two values and return True or False:
== Equal
!= Not equal
Greater than
< Less than
= Greater than or equal
<= Less than or equal
Logical Operators
Combine conditional statements:
and – True if both conditions are true
or – True if at least one condition is true
not – Reverses the result (True becomes False)
Assignment Operators
Assign values to variables:
= Assign
+= Add and assign
-= Subtract and assign
*= Multiply and assign
/= Divide and assign
Membership Operators
Check if a value exists in a sequence:
in – True if found
not in – True if not found
Identity Operators
Check memory location:
is – True if both variables point to the same object
is not – True if not the same object
Top comments (0)