+ 1
Python Code - Linear Search
I am able to run this code perfectly fine on the IDLE which is downloaded in my laptop but the same won't run here in the code playground . Why so ? CODE: def Lsearch(ar,item): i=0 while i<len(ar) and ar[i]!=item: i+=1 if i<len(ar): return i else: return False b=[2,7,5,3,9,4] Lsearch(b,3) P.S : I have the screenshots of the same . Don't know how to upload it.
4 Réponses
+ 3
Hi Sreyashi Bhattacharjee!
I tried running your code on Sololearn's Code Playground, and it worked quite fine! What did it say when you ran it?
Your code doesn't have any output, so I had modified the last line to
print(Lsearch(b, 3))
P.S., uploading screenshots/images is tricky. You can post it in your own feed or upload it to Imgur/Dropbox/Google Drive and share a link here. But I don't think that would be necessary in this case.
+ 2
Make a code and publish here the link, making it easier to debug for who reads
+ 1
It was saying
"No output"
Thank you for the corrections.
+ 1
Oh, okay! Happy to help! 😊