WEIGHT
Midterm exam will be 25% of your total grade and 66.5 points
The programming assignment will be worth 40 points and the remaining 26.5 points will be quiz questions, similar to those from weekly quizzes you take (many will be same)
on the programming assignment, you will be able to receive up to 30% extra credit (12 extra points), it will be documented exactly how you can gain those.
You will be given up to 3 hours (assignment will be available 9am -1pm) to complete and submit the programming assignment and the quiz portion will have 1 hr time limit, about 50-60 questions and will be available for 5 hours 9am -2pm
The programming assignment will be worth 40 points and the remaining 26.5 points will be quiz questions, similar to those from weekly quizzes you take (many will be same)
on the programming assignment, you will be able to receive up to 30% extra credit (12 extra points), it will be documented exactly how you can gain those.
You will be given up to 3 hours (assignment will be available 9am -1pm) to complete and submit the programming assignment and the quiz portion will have 1 hr time limit, about 50-60 questions and will be available for 5 hours 9am -2pm
COMMON MISTAKES FROM PREVIOUS MIDTERMS
- true is not a valid value in Python, True is, same with false
- variable identifiers cannot start with a number, like 3c
- Question on evaluating True or not True and not True. This is how most of the students processed it:
The way you should think of this is: or == + and == * True == 1 False == 0
With that, you would have: 1+0*0=1, hence True is correct answer
- {} defaults to dictionary
>>> type(t)
<class 'dict'>
- copying lists and deep copy
- Sets cannot have sets in them
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'set'
- Many cannot read list comprehensions
- Lot of problems parsing and matching regex patterns
- Lot of problems with lopping and modifying two-dimensional lists
- not recognizing that you cannot explicitly type a variable in Python, ex: int a is not allowed
- difference between // and /, try this by 10/3 and 10//3
- String and other types in Python cannot be concatenated using +, you have to convert the data into same type, for instance, try to concatenate "hello"+3
- Rules for naming variables here
- "aa"*3 = "aaaaaa"
- x = input("something"), x will always a string, if we are trying to read a number, it has to be converted. Learn about it here
- nested loops and tracing the variable values, here is a sample program to practice on, you may also want to try to use i in the while condition of the second while, like i < a
i=0 a=0 while(i < 10): while(a < 5): i += 2 a += 1 print(i)
- range() function with 2 or 3 parameters
- know all immutables, how each is created and recognize when they are being modified, an error will the thrown
- slicing lists and strings
- Matrices (two dimensional lists) - iterating through elements in nested loops
- Sorting list of strings using x.sort() - capital letters come before lower cases, try some examples
- Copying one and two dimensional lists, shallow copy
- looping through sets, lists and dictionaries, retrieving dictionary values/keys while looping
- functions (I expect you to memorize how to write a function) and recursions
- function parameters with * and **
- passing parameters to a function and modifying them inside the function for numbers and string, here as sample program to practice on
def test(a,b,c): a=10 b=3.3 c="aaa" x = 0 y = 0.0 z = "zzz" print(x) print(y) print(z)
- os.walk() and how to retrieve full path to the file, fnmatch basics
- I did not expect you to write one, but I expected you to know basic usage of pickle
- Understand that shelve works just like dictionary and stores data into a file
- regular expression basics - what module is used, \d \w [A-z] {0,4}
- converting JSON to a dictionary/list structure and parsing it