Data Types Flashcards
What will the following expression evaluate to?
bool((5-5))
IT would equal false since 5-5=0 and zero equals false
What will the following expression evaluate to?
bool(1-1) == bool(0)
it would equal 0 which 0=0 is true
What will the code below output?
value = "500" print('The value', value, 'divided by 5 equals', int(value)/5)
it would output
The value 500 divided by 5 equals 100.0
it does the .0 because a single division sign it will automatically assume it will have a remainder
The built-in ______ function returns a unique identifier of an object that is referenced by a particular variable
id()
keyword is identifier
Maximum values for integers are inherently limited by the Python interpreter at runtime.
False
Python3 does not limit the maximum value of an integer, it is unbounded. Unbounded is a mathematical term for functions and values that have no maximum value.
An integer in defined in Python by using the reserved keyword int
True
An unbounded integer is an iteger whos value is dependent on the interpereter at runtime.
False
Unbounded is a mathematical term for functions and values that have no maximum value.
The size of the integer is limited to the size of the registers/memory allocated to the integer within the operating system
Strings are immutable, which means they cannot be changed once theyre created in memory.
False.
Per the slides
A Python expert would describe strings as an “immutable sequence of zero or more characters.”
Immutable, in that strings cannot be changed once created.
Using the multiplication operator with a string and an integer results in the string being repeated as many times as the integer’s value.
True
a = 5 b = 10 c = 15
x = a + b y = x - c z = y-x+c
z = bool(z)
print(z)
so x= 15 then y = 0 then z=30 but 30 is not one or a zero so it is false as a boolean value