# Data Analysis with Python - Numpy Operations

### Tell us what’s happening:

Reiterating earlier posts’ findings that have yet to be validated, as of 8/26/2024. The answer should be A (aside from the last 2 values in its array being 24, 24 instead of 23, 24). In the demonstration, the code output for a = np.arrange(5) was already shown to be B (0,1,2,3,4). And also that subsequent a + 10 = (10, 11, 12, 13, 14). Then the answer to what does a = np.arrange(5), then a + 20, must be A (20, 21, 22, 23, 24). Yet official answer is B (0,1,2,3,4), as if a + 20 wasn’t included.

### Your browser information:

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36`

### Challenge Information:

Data Analysis with Python - Numpy Operations

The correct answer is `B` because the operation does not change the value of `a`, which remains the same. To make it change you should use assignment:
`a = a + 20`

1 Like

Per the teaching in this lesson, which this question is to test our learning from, under the Broadcasting and Vectorized operations heading, 4 lines down it simply has “a + 10”, with an output of "array ([10, 11 12, 13]), when “a” on the line prior is “array ([0,1,2,3])”. This is a 1:1 for this test question. Please see screenshot with evidence, which you can verify in the teaching.

It is a slightly misleading or “trick” question, I agree.

The question though is “what is the value of `a`” not “what output is generated in a notebook”. The fact that the notebook shows you this output is specifically because of the functionality of the notebook.

In VSCode the same code would have no output and if you `print(a)` it would retain it’s original value. Same if you `print(a)` in the notebook to display the value of `a`.

The question is “What is the value of a (detail: image of ‘a’ in Jypter notebook - contextual) after you run the following code?” After you run the code (output like without being print output per se), not before you run the code.
The Jupyter notebook is the entire context of the training, and the underlying assumption in all of these activities. There has been absolutely zero training in a non-Jupyter context for Python in this training up to this point. How is testing us on information we have not been taught in this course, a valid test for this course? To measure what we’ve learned from it, or outside of it? Context is to be in line, not thrown out for knowledge outside of this course. Are you trying to train your students or frustrate them? The question does not define the context of Jupyter, nor VSCode. In line context is understood (Jupyter).
Is there a better way to test a student has learned the knowledge of this training unit without using a non-contextual trick question, that still tests the knowledge that should have been gained from this unit? Especially since you’ve admitted the in Jypyter context correct answer is A, in contrast with the official correct answer, as we’ve been reporting?

Is the intent to test Jupyter notebook vs. VSCode knowledge? Or the knowledge of this unit? What was the thrust of this training, we are demonstrating we learned?

This is not accurate.

If you `print(a)` in a notebook, you will see the value of `a` is the same. You can’t argue the accuracy of this question. It is accurate and you are incorrect, that’s not debatable, sorry. Try to have some humility and accept the evidence that’s quite easy to verify.

Maybe the question is to test (and teach) if you know the difference between some output and a re-assignment. It doesn’t really matter if you got the question wrong, take it as a learning experience and just move on.

I think it’s fair to argue if it’s a tricky question, because it’s fooled many people (including myself) and maybe it should be changed to be more straightforward. You can’t argue about the accuracy though.

Print(a) when? Is that the question asked in the test?

No, when you run the exact code in the test question in the notebook you get answer A (…23, 24), not answer B. I’ve already provided the screenshot evidence from the training itself.

Disagree

`print(a)` will display the value of `a`

This discussion proves the value of the question.

Not really sure what you’re indicating here?

The result of `a + 10` is being printed, but the value of `a` is not being changed.

The question asked is the test is: " What is the value of `a` after you run the following code?"

You could also just put `a` by itself in a cell and it will output the value of `a`. I encourage you to test this out yourself.

I apologize. I see what you mean now. I relistened to the teaching and he clearly calls this out. The test would have had to say a += 20 for answer A to be correct. As the first reply to this post answered. And the …24, 24 ending in answer A may have even been a further clue.

I truly apologize for taking your time on this. I should have relistened more carefully before posting this. The prior posts on this same question did not appear to reach resolution and agreement between the originator and replies, so I thought this was still outstanding. Quick to listen, slow to speak.

Thank you, sincerely. I intend to remember this.

1 Like

Glad we were able to resolve it here! I reviewed the other threads on this topic and yes, they all kind of fizzle out after the first response.

1 Like