UBC-MDS / programming-in-python-for-data-science

https://prog-learn.mds.ubc.ca/
Other
20 stars 22 forks source link

Feedback Module 6 #45

Closed hfboyce closed 4 years ago

hfboyce commented 4 years ago

@mgelbart Here is the first draft of Module 6! it is available here. There is also assignment 6 that is done too ( here).

I plan to organize and start content for Module 7 Monday and Tuesday!

mgelbart commented 4 years ago

Posting what I've done so far (Ex1) in case you want to review it before today's meeting. I'll try not to forget the rest this time!

mgelbart commented 4 years ago

Here is 9-16, I'll have to do the rest tomorrow (or Thursday at the latest!):

mgelbart commented 4 years ago
assert 1 == 1 , "1 is not equal to 1." (note your message needs to be changed here)
print('Will this line execute?')

and

assert 1 == 2 , "1 is not equal to 2."
print('Will this line execute?')
def bad_function(numerical_list, exponent=2):
    new_exponent_list = [numerical_list[0] ** exponent] # seed list with first element
    for number in numerical_list[1:]:
        new_exponent_list.append(number ** exponent)
    return new_exponent_list

which will fail for an empty list.

assert acronym_it("Hard work pays off") == 'HWPO'
assert acronym_it("Hard work pays off") == 'Hwpo'
assert acronym_it("Hard work pays off") == 'H'
assert acronym_it("Hard work pays off") == str

and then we don't need the ??? at all. Then for the answers you'll just need to repeat the 4 lines like you did for 18.2. And for 18.2 I'd also show the 4 lines.

In particular "what happens if we want to do other calculations with the dataframe?" is a bit vague.

Incorrect. Perfect! Let’s make the count variable (in this case the 7) an input argument.

😂

hfboyce commented 4 years ago

I would also mention that it also uses the local copy if it comes in as an argument def squares_a_list(numerical_list, a_new_variable)

I'm not sure what you mean, like if

def squares_a_list(numerical_list):
    a_new_variable = "Ta-Da!"
    print( a_new_variable)

    new_squared_list = list()
    for number in numerical_list:
        new_squared_list.append(number ** 2)
    return new_squared_list

and we said numerical_list = [54, 25, 3] from within the function?

1.10: These are very dangerous waters. Also this is technically true, it's also misleading. Because if global_var is a list then you can modify its elements inside of the function, even if you can't modify "the list itself". I think we might be better off saying the situation is complicated and we recommend not trying to do this. Update: oh, now I look at 1.11. Hah. Ok soo... I think we'd better drop 1.10 and go straight to 1.11. I think 1.10 just muddies the waters. Then we'd also need to remove "Since we did not use the assignment operator, we were able to make a modification to the global variable. " in 1.12. Or, if we really want 1.10, I'd at least move it to the end or something.

I just removed 1.10 altogether. That work?

1.16: you didn't show the calling of the function - should show it!

I do show it? It just doesn't produce an output since the function has no return.

1.17: not sure if this is coming later, but we should say that if you have side effects, they need to be clearly documented in the docstring (have we taught docstrings yet? if not, do we want to reorder?)

We tackle docstrings 2 slide decks from now. Should I come back to it in that section or do we reorder?

2.2: I got this wrong also. But are you sure?? I think it might be better to remove this, per my comments about 1.10 above.

I use real code for all these and the answer is what I implied as correct. I still am not 100% sure why we would cut in this case because I'm just asking for the output of the function essentially which uses the local variable.

4: consider splitting this into 2 code blocks, so they can more easily see the output of the provided code- not possible currently because of all the ___

Commented this out instead? Does that work?

I'm having a problem with docker. For ex 4, I press run code and get an error. Then I deleted all the ___ and pressed "run code" again but nothing happens! Does this happen to you as well??

Can you try it again now that I've commented things out? I can explain the issue at our meeting.

9.9: I'm not sure, pls check if the default part needs to be in more of a standardized format in the numpy style, e.g. "default = 2" or "default : 2"

This is now the format as recommended by the documentation

we should clarify that part of the use is people who are directly looking at the code, not just this ? type thing

? Je ne comprend pas

13.5: Argh, I know I keep contradicting myself, but I wonder if we should have just gone with if type(numerical_list) != list instead, so they didn't have to learn something new here. Let's discuss at the next meeting. ;;

DISCUSS

there's a confusion here between what "an exception" is. Is this an exception? Exception("You are not using a list for the numerical_list input.") I guess so. But in my head I immediately think of different types of exceptions if someone talks about different exceptions. So maybe we shouldn't muddy the waters by saying that Exception("A") and Exception("B") are two different exceptions.

This needs elaboration please

17.6: "It’s also good to do multiple test to for different list sizes" (multiple grammar issues). ;; we should be consistent here and use isinstance if that's what we're teaching

I initially included isinstance since it's the easiest way to test if an object is of type pd.DataFrame. Instead I removed it and added a hint in the assignment to use that function. Is this ok?

17.11: I'm a bit confused about this, because this code does not run. Would return list() be better? I would prefer something that runs.

What do you mean? which code?

?

Is this ordering taken from somewhere?

Your lecture actually 😂 actually. See here

3: have they heard the term pseudo-code before?

No but I explain it in this slide. Is that not enough?

18.1: put "not" in bold/italics like 18.2

Are you looking at the same question as me?

19: missing a space in the last choice;; also, I don't know, this one is a bit subjective. There might be a purpose to those tests. for bad tests, what if you add a docstring to the function that shows the inputs are supposed to be numbers, and then have a silly test like multiply(["a", 5]) == "aaaaa", which passes, but doesn't really test what the function is supposed to be doing?

Remove then?

21: do we really need the messages here?;; again, we should decide if we're doing type(x) == or isinstance. I wonder if maybe type(x) == is better. but my problem is an ego/vanity problem, that I don't want to look like I don't know. In such cases I usually pick the way that's better for students but add a little disclaimer like "See isinstance for a more advanced approach."

Adding messages just so they have familiarity with it and removed isinstance

Or could we go with the example from DSCI 511 instead?

I've been using DSCI 511 as a resource. Which example are you referring to?

22.9: needs a bit of work. let's be more specific about the pain points:

Let's talk about this a bit more.

hfboyce commented 4 years ago

1) argument to function with same variable ( uses the one with the argument)

2) remove 1.10

3) 1.16 show function -> call it on same slide when call 1.17 show unheated function, calling function and cereal all on same slide and function still worked (unheated cereal)

If you do have side effects you document them HERE is where we mention side effects (in docstring)

exercise 4) pass in weight_lb and remove return statement. change wording to just global and local environment

change "loading to blank"

sentence for reading document

isinstance add note in content-> there is a more robust way using isinstance (see here ->) we don't want to over complicate this In the interest of avoiding new syntax (this is a simple way of doing this, for a more robust approach see link)

17.15 return empty list here

peusdo code (say in the comments )

18.2 BOLD not

  1. put question separately
    1. 4 - 22.6