What this inspired by 20170810-dojo-stairs.ipynb?
In [1]:
    
s = 'to/stairway/heaven'
s
    
    Out[1]:
In [2]:
    
terms = s.split('/')
terms
    
    Out[2]:
In [3]:
    
'to' in terms
    
    Out[3]:
In [4]:
    
'to' in terms[1:]
    
    Out[4]:
In [5]:
    
from collections import deque
    
In [6]:
    
d = deque(terms)
d
    
    Out[6]:
In [7]:
    
while d:
    print(d)
    d.popleft()
    
    
In [8]:
    
import math
    
In [9]:
    
math.gcd(256, 10**6)
    
    Out[9]: