What module/library must you import to read CSV files?
csv
This method often used with for loops, allows us to loop through set boundaries.
range()
Python is a _______ language, meaning user community freely participates in defining the language and creating new interpretations of its Syntax.
open-source
What is the output of the following code?
myList = [1,2,3]
print(myList[3])
IndexError
This type of function is also referred to as a setter
Mutator
This method, often associated with File I/O, is used to strip specific characters like white space from the BEGINNING of a string.
lstrip()
Name 2 issues from the following code-
for i in range(5)
Print(i)
Missing colon
'p' in print should not be capitalized
To test against program crashes, we should generate ______ test inputs and verify their outputs.
Negative
What is the difference between a list and a tuple?
A list can be changed once created, tuple cannot.
A tuple has a specific order to their items, list does not
Global
What are the 2 types of files that python allows a programmer to work with?
text files and binary files
In loops (for/while) we often use variable names such as "i" or "j" to represent what term denoting what numbered loop we are currently on
Iterator/Iteration
In a flowchart, this symbol is often used to return or end a function.
Oval/Ellipse
What is the output of the following code?
myList = [1,2,3]
print(myList(3))
TypeError
(Python thinks "myList" is being called as a function, its a variable, not function, thus wrong type)
This symbol is used to create an arbitrary dictionary parameter for a funciton.
**
This file mode allows us to do reading AND writing at the same time.
Loops are often used to create what kind of algorithms for lists?
Sorting and Searching
(either will be accepted)
Describe what happens when a piece of data is written to a file?
Data is copied from a variable in RAM to a file.
What is the new value of our List after the following code runs?
my_list = [1,3,5]
my_list = my_list[0] * 3
3
What's the difference between an argument and a parameter of a function?
Argument: a variable used in a function call that SENDS the value to the parameter.
What is the output of the following code?
f = open("data.txt", "w")
f.write("Hellow")
f.close()
f = open("data.txt", "w")
f.write("World")
f.close()
f = open("data.txt", "r")
print(f.read())
World
Try-excepts, often times provide a higher level of ______ than loops. As we need to handle riskier situations.
Validation
Input Validation.
Two programs produce the same correct output. One is written in 20 lines, the other in 200 lines. Which of the two is GENERALLY considered the better design, and why?
Lists are ______, meaning their elements can be changed and the object is updated throughout the entirety of a program.
Mutable
To refer to a function being called from an imported module, Python uses ____ notation
.
dot
module.function()