-
What are the entries in a dictionary?
key - value pairs
-
Write the Python expression that gives the value of the first command line argument.
sys.argv[1]
-
What is the name of the module that allows you to interact with the Python interpreter?
sys
-
If we have the sets A and B with the elements below, what are the elements
formed by the union of A and B?
A = {1, 2, 3}
B = {3, 4, 5}
{1, 2, 3, 4, 5}
-
What is the name of the module that allows you to interact with the operating system?
os
-
What does the . (dot) in a regular expression match?
one occurrence of any character, except the newline
-
Can a value appear more than once in a set?
no
-
Write the Python expression you would use to get a list of all entries in your current directory.
os.listdir('.')
-
What string value does Python think of as
False in an if statement?
the empty string
-
Write a Python expression to see if the set s1
contains 5.
5 in s1
-
What is a greedy match?
a match with the greatest number of characters
-
What does the + in a regular expression match?
1 or more occurrences of the character that comes before it
-
What are three things are found in a regular expression?
ordinary characters, meta-characters, character classes
-
Write the Python statement you would use to stop execution of a script.
sys.exit()
-
Are dictionaries sequences?
no
The following questions require you to write code.