CIS 312 Dr. Childs Python Exam 1
End-of-line comments begin with the __ symbol.
#
___ is the format operator.
%
In Python, ___ is the exponentioniation operator.
**
The escape sequence ___ is the new line character.
/n
What is the output for this loop? for count in range (4): print count
0 1 2 3
A __ must follow the else in an if-else statement.
:
In Python, a _ ends the loop headers.
:
To extract a substring, the programmer places a __ in the subscript.
:
The string function ____ returns a copy of the string, centered within the given number of columns.
center
The ______ file system function changes the current working directory.
chdir
The ____ function is the inverse of the ord function.
chr
In Python, you can write a print statement that includes two or more expressions, separated by ______.
commas
The string function ____ returns the number of non-overlapping occurrences of a substring in the string.
count
Unlike an integer which cannot be factored into more primitive parks, a string is a ___________.
data structure
The _______ file system function returns the path of the current working directory.
getcwd
Python is an ______ language.
interpreted
The string function ____ returns a string that is thee concatenation of the strings in the sequence.
join
Python's _____ function returns a string's length when it is passed a string.
len
The _______ file system function returns a list of the names in the given directory.
listdir
The string function ____ returns a copy of the string converted to lowercase.
lower
The _______ file system function creates a new directory with the given name, and places it in the current working directory.
mkdir
Python's open function, which expects a file pathname and a _____ string as arguments, opens a connection to the file on disk and returns a file object.
mode
The function ________ returns a random number from the numbers between the two arguments and including those numbers.
randint
Python's ________ module supports several ways to generate random numbers.
random
The ______ function of a file object inputs the contents of a file and returns them as a single string.
read
The _________ function of a file object inputs a line of text and returns it as a string, including the newline.
readline
In Python, a string literal is a sequence of characters enclosed in _______.
single or double quotation marks
The string function _____ can be used to obtain a list of the words contained in an input string.
split
In Python, the values of most data types can be converted to strings by using the ____ function.
str
The string function ____ returns a copy of the string with leading and trailing whitespace characters (tabs, spaces, and newlines) removed.
strip
The ______ argument of Python's range function specifies a step value.
third
"%6s" % "four" right-justifies the string by padding it with _______________________.
two spaces to its left