Last answered:

22 Oct 2022

Posted on:

20 Feb 2022

0

Jupyter not showing output

I replicated the linear search and the binary search functions. They run without error, but the True and False after the tests do not show up. Yes, I told the function to return found. In fact, I eventually copied and pasted the entire 365 Data Science code into my notebook, and I still have problems. The provided class code works, but my copied and pasted version of it does not show the True and Falses after the tests. Please help!
NOTE: the code I wrote works in Spyder. Just not in Jupyter.

def linear_search(item, my_list):
    i = 0
    found = False

while i < len(my_list) and found == False:
        if my_list[i] == item:
            found = True
        else:
            i = i + 1
    return found







test = [6,5,8,2,3,45,87,24,70]
print(linear_search(4,test))
print(linear_search(88,test))





No true or falses show up.

4 answers ( 0 marked as helpful)
Instructor
Posted on:

21 Feb 2022

0

Hey Matt,

Thank you for your question!

Could you please do the following:

1. Share a screenshot of these two cells in the Jupyter notebook.
2. Let me know what key combination you are using to execute the cells.
3. Let me know which browser you are opening your Jupyter notebook with.
4. Restart the kernel, run the cells again and let me know if the output shows up.
image.png

Thank you!

Kind regards,
365 Hristina

Posted on:

22 Feb 2022

1

Hey there,
I am sorry to waste your time. It is working fine today. I am not sure what was up, but whatever. I am in Chrome. Here is the picture, not that you need it anymore. Thanks anyway!image

Instructor
Posted on:

22 Feb 2022

0

Hey again Matt,

No worries, let us know if it happens again.

Kind regards,
365 Hristina

Posted on:

22 Oct 2022

0

I am not getting any output in Jupyter
image.png

Submit an answer