hi,
i have a function that returns a string. For eg: 11111 or 11011.
1 is Pass and 0 is Fail. i want my code to scan the string from right to left side and also look for 0 and indicate its location. Below is my code. But i'm having problem:
1. It scans from left to right.
2. It scans the string bit by bit and so goes into the except part of the code.
c=('01101')
i=-1
try:
while i<len(c):
i=c.index('0',i+1)
print "Lane fail",i
except ValueError:
print "All Lanes PASS"
pass
Result:
>>>
Lane fail 0
Lane fail 3
All Lanes PASS
What i want the Result to show:
>>>
Lane fail 0
Lane fail 3
thanks