LPTHW Flashcards
+
plus
-
minus
/
slash
\
backslash; encodes difficult-to-type characters into a string
*
asterisk
=
equals; assigns the value on the right to a variable on the left
[ ]
index operator; gives access to a sequence’s element (index of the item you want to access); must be an integer
{ }
used to embed variables in a string; must also starts string with f for format
prints the specified message to the screen, or other standard output device
def
defines a function
rewind
inbuilt function which is used to set the position of the file pointer to the beginning of the file
seek(0)
move the read/write location to the beginning of the file; seeks a specific spot in the file
readline
reads just one line of text
import
gains access to code in another module by importing it; it searches for the named module, then it binds the results of that search to a name in the local scope
close
closes the file; like File->Save
read
reads the contents of the file; you can assign the result to a variable
open
open a file using the file() type, returns a file object
exists
returns if a file exists; add more
input()
allows user input
prompt
a string, representing a default message before the input
truncate
empties the file; watch out if you care about the file
write(‘stuff’)
writes “stuff” to the file
len()
returns the length of a string
round()
returns a floating point number that is a rounded version of a specified number, with specific number of decimals