Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # occurance_index.py
- def index_occur(var,target,n,z=0):
- for i in range(n): z = var.index(target,z+i)
- return z
- T = ('1st target is at 1', 5, '2nd target is at 3', 5, 3, -1, '3rd target is at 7', 5, 25)
- print (index_occur(T,5,3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement