im a beginner of coding and using python.
Im trying to code for a linear search but I don't know how to:(
Jump to Post
First of all, why linear search? That's like the worst algorithm to use ever.
But if you don't want to use the Python internal algorithm, a for loop can do it:
def findValue(v, li): for i in len(li): if v == len[i]: return i return -1
But that's such …
All 7 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.