Course 2: Python for Data Science, AI & Development Flashcards
(22 cards)
Types
how python represents different types of data
what does bool(1) yield?
TRUE
what does bool(0) yield?
FALSE
expressions
type of operation the computers perform
what does a double slash (//) in a division operation do?
rounds to nearest whole number
variable
used to store values
how to assign a new valuable to existing variable
use : instead of =
what does int(true) yield?
1
if name=”Michael Jackson”, what does name[2] return?
“c”
if name=”Michael Jackson”, what does name[0:4] return?
“Mich”
if name=”Michael Jackson”, what does name[::2] return?
“McalJcsn”
if name=”Michael Jackson”, what does name[0:5:2] return?
“Mca”
\n
new line
\t
tab
\
\
print(r”Michael Jackson \ is the best”) returns?
Michael Jackson \ is the best”
A=”Thriller is the sixth studio album”
B=A.upper()
B returns what?
“THRILLER IS THE SIXTH STUDIO ALBUM”
A=’Michael Jackson is the best’
B=A.replace(‘Michael’,’Janet)
B returns what?
‘Janet Jackson is the best’
tuples
ordered sequence written as comma-separated elements within parentheses and are immutable
what does it mean to say a tuple is immutable?
not capable of change
lists
ordered sequence similar to tuples written as comma-separated elements but within brackets and are mutable
aliasing
multiple names referring to the same object