Python - Data Types Flashcards
Review Major Concepts of Data Type in the Python Programming Language
Research: what is a Data Type in the Python Programming Language.
Data values in Python are known as objects; each object, aka value, has a type.
List and Describe: each Data Type in the Python Programming Language.
Numbers
Sequences
Sets
Dictionaries
None
Ellipsis (…)
Callables
Boolean Values
What are the three built-in types that are numerical data types?
The built-in numeric types in Python include integers, floating-point numbers, and complex numbers.
List and Describe: the four Integers literals of the numerical data types.
Decimal
A decimal literal is a sequence of digits in which the first digit is nonzero.
Binary
A binary literal is 0b followed by a sequence of binary digits (0 or 1).
Octal
An octal literal is 0o followed by a sequence of octal digits (0 to 7).
Hexadecimal
hexadecimal literal is 0x followed by a sequence of hexadecimal digits (0 to 9 and A to F, in either upper- or lowercase).
Describe: floating-point literals of the numerical data types.
A floating-point literal is a sequence of decimal digits that includes a decimal point (.), an exponent suffix (e or E, optionally followed by + or -, followed by one or more digits), or both.
Describe: Complex Number of the numerical data types.
A complex number is made up of two floating-point values, one each for the real and imaginary parts.
You can access the parts of a complex object z as read-only attributes z.real and z.imag.
Examples: 0j, 0.j, 0.0j, .0j, 1j, 1.j, 1.0j, 1e0j, 1.e0j, 1.0e0j
You can specify an imaginary literal as any floating-point or integer decimal literal followed by a j or J. The j at the end of the literal indicates the square root of -1, as commonly used in electrical engineering (some other disciplines use i for this purpose, but Python uses j).
A sequence is an ordered container of items, indexed by integers. Python has built-in sequence types known as strings (bytes or str), tuples, and lists.