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 is the ‘numbers’ data types in the Python Programming Language?
The ‘numbers’ data types are built-in numeric types such as integers, floating-point numbers and complex numbers.
What is a ‘sequence’ data type in the Python Programming Language?
A sequence is a container of ordered of items, indexed by integers.
What is a ‘set’ data type in the Python Programming Language?
A ‘set’ is a container of an arbitrarily ordered collection of unique items that can be of different types.
What is a ‘dictionary’ data type in the Python Programming Language?
A ‘dictionary’ is a container of mappings of an arbitrary collection of objects indexed by arbitrary values. An array of key-value pairs.
What is the ‘none’ data type in the Python Programming Language?
The ‘none’ data type denotes a null object.
Describe ‘callable’ data types in the Python Programming Language?
A ‘callable’ data type supports the function call operation. Examples are function, generators and methods.
What is the ‘boolean’ data type in the Python Programming Language?
A ‘boolean’ data type evaluates to either True of False. Any data value in python can be used as a truth value.
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).
Name three types of sequences in the Python Programming Language
Python has built-in sequence types known as strings (bytes or str), tuples, and lists.
Research: the term ‘iterate’, ‘iterable’ and ‘iterator’.
An iterable is any Python object capable of returning its members one at a time, permitting it to be iterated over in a for-loop.