Talk like Pythonista 1 - Data Types
In programming languages data types using to represent and understand the value of data.Beside of that , we can decide what operations can be performed on data.Each programming languages has same approaches generally , but it is not standartized and every languages has their data type classification.
In Python , we’ve got
-Numbers
-Boolean
-Strings
NUMBERS
Any numeric value classified as Number.These numbers has types according to their represented data.These are integers , floats and complex numbers.In Python 3 , the limit is only computer memory for decide to how long data will be represent.However float values are represented as 64-bit double-precisions.
-Integers
Positive or negative whole numbers are integers.Python using decimal system for all numbers.However if we need to other number systems,we can use prefix with numbers.
Prefix | Interpretation | Base |
---|---|---|
0b (zero + lowercase letter ‘b’) | Binary | 2 |
0o (zero + lowercase letter ‘o’) | Octal | 8 |
0x (zero + lowercase letter ‘x’) | Hexadecimal | 16 |
Some examples with integers
1 | >>> 3 |
type() method returns class type of the argument(object) passed as parameter.
-Floats
Float number are fractional.
1 | >>> 3.2 |
E-notation is known as exponential notation or scientific notation.1e6 is equivalent to 1×10⁶.