I am doing a problem in leetcode where I am supposed to return the index of the specific target, here's the code:
class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
l=len(nums)
for i in range(0,l):
if(nums[i]==target):
print(i)
The error I get:
TypeError: None is not valid value for the expected return type integer
raise TypeError(str(ret) + " is not valid value for the expected return type integer");
I was expecting the index to return