1/37
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
interpreter
processes a program line-by-line
compiler
processes a program’s code as a whole
Symbol to comment in python?
#
Triple quotes
used for multi-line strings
\n
new line
\t
tab
**
exponent
// (operator)
floor division (round down)
list
contains multiple of the same data type
tuple
list, but immutable
dictionary
stores key-value pairs
keys()
returns all the keys in a dictionary
values()
returns all the values in a dictionary
items()
returns all the key-value pairs in a dictionary
range function
(start, stop, step)
break
exits loop
continue
moves to next loop iteration
Set
can contain multiple elements of different data types
uniform()
returns random float between (a, b)
random()
returns random float between (0.0, 1.0)
randint()
returns random integer between (a, b)
relative path
location relative to current working directory
absolute path
location starting from root of the file system
os.sep
view os separator
r
read (start at index 0)
w
write (start at index 0)
a
append (start at end of file)
r+
read and write
w+
write and read
a+
append and read
rb
read binary file
wb
write to binary file
ab
append to binary file
with keyword (Python file operations)
closes a file after operations in the block are finished
shutil.copy()
copy a file from source path to dst path
os.walk()
generates the file names in a directory tree by walking either top-down or bottom-up
rfind()
return the highest (rightmost) index where a substring is found
AttributeError
error is raised when you attempt to change an element of a tuple