I have a loop in the form as below. I want to break and come out of the entire while loop if p>len(number)
. Number is a list here containing some numbers.
The below code is not breaking from the entire loop when p is more than the len(number). Can some one help with an implementation in python.
while number[p]<0 :
if "some condition":
#do something
p=p+1
if p>len(number):
break;
else:
#do something
p=p+1
if p>len(number)
break;