mikeizbicki / cmc-csci040

Computing for the Web
37 stars 58 forks source link

Lab_02 #247

Closed dwalker25 closed 1 year ago

dwalker25 commented 2 years ago

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 commented 2 years ago

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

justin-is-away commented 2 years ago

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

mikeizbicki commented 2 years ago

@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.

AjaiKBan commented 2 years ago

Good evening @mikeizbicki ,

What does it mean if items have no tests?

AjaiKBan commented 2 years ago

Never mind.