Data Types and Structures Flashcards
What is an Integer Data Type classified by?
An integer is a data type which is a number without a decimal point and is defined by the function int().
What is an Float Data Type classified by?
A float is a data type which is a number with a decimal point and is defined by the function float().
Which function can be used to find out which data type is a certain value?
You can use the type() function.
What happens when you use the int() function on a float value?
The value after the decimal point is taken off and no rounding occurs.
What happens when you use the float() function on an integer value?
A decimal point and a 0 is appended onto the number.
What is a boolean?
A boolean is a data type that can have a value of true or false. (Created by George Bool, Boolean Algebra)
What does != mean?
!= means not equal to. (Comparison Operator)
What type of operators are and, not and or?
Logical Operators
What is a string classified by?
It is classified by double or single quotes.
How do you tell Python that this quote is in the string not the syntax?
By using a backslash. ()
What is the symbol to add and multiply strings?
+ for addition; * for multiplication
How can you reference the first item of a list?
print(list_name[0])
How can you reference the last item of a list?
print(list_name[-1]) (Not print(list name[-0])
What code do you use to slice the list from index 5 to 9?
print(list_name[5:9])
What is a tuple?
A data type for immutable ordered sequence of elements.