ccsf-math-108 / materials-fa23

Fall 2023 student course materials for MATH 108 Foundations of Data Science at CCSF
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

HW 08: Task 01: Type Check Error Puzzlement (Dunno) #40

Closed asheynis closed 10 months ago

asheynis commented 10 months ago

In HW 08, Task 01, the type check for sample_size is testing to see if it is strictly a native Python int. On the first go around, the test comparing sample_size to int failed on the following four approaches (I was aiming for a more robust process by summing an array of those number as it is a better paradigm for when dealing with more groups/numbers to sum):

  1. Using NumPy's sum function which returns a NumPy int followed by the item() method to get the value as a native Python int.
  2. Using Python's native sum function which correctly returns an int type since the inputs are all native ints.
  3. Explicitly typing out the sum which is a native Python int.
  4. Just typing in the number as an integer

I reverted the notebook back to its original state and the grader check worked without issue. I hadn't opened it until this morning for the first time, so I am not sure what happened that first time. I am not sure what happened or if it is replicable. I wish I took screenshots of the issue. Just thought I would mention that it happened in case anyone else also encounters this problem.

asheynis commented 10 months ago

I will say that in general, the tests only testing for native Python types will fail if an outcome is a NumPy type which I don't think it should be doing. I think either type should be valid.

shawnwiggins commented 10 months ago

Correct. I would prefer that the graders accept a variety of data types. I'll update that test and the other similar ones in the notebook that check for data types. Thanks!

Steps

shawnwiggins commented 10 months ago
asheynis commented 10 months ago

Yeah. It's funny how that type testing issue doesn't come up consistently.