cmc-csci040 icon indicating copy to clipboard operation
cmc-csci040 copied to clipboard

Lab_02

Open dwalker25 opened this issue 3 years ago • 5 comments

Hi @mikeizbicki,

I'm not sure why my code for the hypotenuse function isn't working, even though it seems straightforward. It looks like it is adding "+0j" for some reason. Here's a screenshot: screenshot_hypotenuse

Thanks! -David

dwalker25 avatar Sep 18 '22 04:09 dwalker25

Similarly, I'm having a problem with my Fibonacci function, even though I've compared it with friends and they are using the exact same code. Not quite sure what the failure is here: screenshot_fibonacci

Thanks again! Sorry to double up on the screenshots. -David

dwalker25 avatar Sep 18 '22 04:09 dwalker25

Two more quick questions - I think I passed all the tests, since this is the output I'm getting after running the test (no outputs). How would I submit this?

image

Additional image showing that this command wasn't working at all:

image

justin-is-away avatar Sep 18 '22 04:09 justin-is-away

@dwalker25

For the hypotenuse function, the example I showed in class was return (a**2 + b**2)**(0.5), which will work. The sqrt function adds the +0j term (making the number complex instead of real).

For your fibonacci function, you didn't actually show very much output, so I can't say for sure, but I suspect that your lab.py file is different than the lab.py file that I posted to github. Likely you copy/pasted the file from github into vscode rather than downloading the file directly, and your computer corrupted the contents during the copy/paste procedure. If you compare your file to the file on github, I think you'll see that your file is missing some blank lines which are important for the doctests to run correctly.

@justin-is-away

You need to add the --verbose flag after the -m doctest. By default, python will only print the failing doctests (which you have none); to get a summary of all the doctests (both passing and failing) you need to add that --verbose flag.

PS. In the future, you should create a separate issue to ask a separate question.

mikeizbicki avatar Sep 18 '22 04:09 mikeizbicki

Good evening @mikeizbicki ,

What does it mean if items have no tests?

AjaiKBan avatar Sep 18 '22 23:09 AjaiKBan

Never mind.

AjaiKBan avatar Sep 19 '22 00:09 AjaiKBan