Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bouquet = ('R', 'P', 'W', 'W', 'P', 'R', 'R', 'R')
- def rotate(bouquet, k):
- new = ()
- l = len(bouquet)
- for i in range(l):
- new += (bouquet[(i+k)%l],)
- return new
- def valentino_rec(bouquet, k):
- if len(bouquet) == 1:
- return bouquet[0]
- else:
- new = rotate(bouquet, k-1)
- return new[0] + valentino_rec(new[1:], k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement