Members don't see the ad below. Register now!

So the programming quizzes aren't being graded solely on the result printed, because this fails the "Sum of Probabilities" quiz, despite correctly printing 0.36:

#Modify the program to find and print the sum of all 
#the entries in the list p.
p=[0.2, 0.2, 0.2, 0.2, 0.2]
pHit = 0.6
pMiss = 0.2
s=[0,1,1,0,0]

print sum(map( (lambda x,y: x * ( pHit if y else pMiss)), p, s ))

Edit: on the next quiz, I get a "Good Job!" printed just above the execution result area, but a popup message of "Try again!"

Nothing I do gets rid of the "Try again!", even though I'm producing the right result (and returning it from my sense function).

asked 21 Feb, 06:45

tpdi's gravatar image

tpdi
1.2k6

edited 21 Feb, 07:06


I think that Question 9 (sense function) has a bug. I changed my code to the one ST is using afterwards and they also have in the notes and still got the same "Try again" response...

Edit: A note has been added for this question in the "Instructor comments" box:

Issues have been reported with the grading of this question. We are currently looking into it.

link

answered 21 Feb, 09:16

mrigaki's gravatar image

mrigaki
6139

edited 21 Feb, 09:41

These kind of things are normally assessed by a unit test.

link

answered 21 Feb, 06:50

jholyhead's gravatar image

jholyhead
4.2k11

Yeah, that's what I assumed, a unit test that does essentially an assertEqual( ACTUAL_VALUE, value_returned_by_student_expression()). But in that case, any student expression that evaluated to the correct result would pass. That's NOT what's happenning.

(21 Feb, 07:08) tpdi tpdi's gravatar image

But what does it test? Do you have to code in loops as if it were Fortran to pass the test?

(21 Feb, 07:17) lacucharita lacucharita's gravatar image

Presumbaly it's some combination of an assertWhatIsPrinted (the look at the result) and a regex on the code/the text of the Python expression.

(21 Feb, 07:38) tpdi tpdi's gravatar image

the test will vary a parameter to test the logic of the function

(21 Feb, 09:47) jholyhead jholyhead's gravatar image
Members don't see the ad below. Register now!
Your answer
toggle preview

Follow this Question via Email

Once you sign in you will be able to subscribe for any updates here

Q&A Editor Basics

  • to upload an image into your question or answer hit
  • to create bulleted or numbered lists hit or
  • to add a title or header hit
  • to section your text hit
  • to make a link clickable, surround it with <a> and </a> (for example, <a>www.google.com</a>)
  • basic HTML tags are also supported (for those who know a bit of HTML)
  • To insert an EQUATION you can use LaTeX. (backslash \ has to be escaped, so in your LaTeX code you have to replace \ with \\). You can see more examples and info here

powered by OSQA