Integers are whole numbers, positive or negative, without decimal points.
age = 25
temperature = -10
Floats are numbers with decimal points or numbers in scientific notation.
pi = 3.14159
scientific_notation = 6.022e23
Strings are sequences of characters, enclosed in single (' ') or double (" ") quotes.
name = 'John Doe'
message = "Hello, World!"
Booleans represent two values: True or False. They are used for logical operations.
is_python_fun = True
is_raining = False
Lists are ordered collections of items, enclosed in square brackets [ ] and separated by commas.
fruits = ["apple", "banana", "cherry"]
numbers = [1, 2, 3, 4, 5]
Tuples are similar to lists, but they are immutable (cannot be changed after creation) and enclosed in parentheses ( ).
coordinates = (10, 20)
rgb_color = (255, 0, 128)
Dictionaries are key-value pairs, enclosed in curly braces { }, where each key is associated with a value.
person = {"name": "John", "age": 30, "city": "New York"}
grades = {"Math": 95, "Science": 88, "History": 78}
Understanding different data types in Python is essential for building diverse and dynamic applications that can handle a wide range of data and operations.