Data Types
- Number:
- Integer:
Whole numbers (e.g., 10, -5, 0).
- Float:
Real numbers with decimal points (e.g., 3.14, -2.5).
- Complex:
Numbers with real and imaginary parts (e.g., 2+3j).
- Boolean:
Represents truth values (True or False).
- Sequence:
- String:
An immutable sequence of characters (e.g., "Hello").
- List:
A mutable ordered collection of elements (e.g., [1, 2, 3,
"a"]).
- Tuple:
An immutable ordered collection of elements (e.g., (1, 2, 3)).
- None:
Represents the absence of a value.
- Mapping:
- Dictionary:
An unordered collection of key-value pairs (e.g., {"name":
"Alice", "age": 30}).
- Mutable:
Data types whose values can be changed after they are created (e.g.,
lists, dictionaries).
- Immutable:
Data types whose values cannot be changed after they are created (e.g.,
strings, tuples, numbers).
No comments:
Post a Comment