SHARE
TWEET

Untitled

a guest Feb 21st, 2020 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. bouquet = ('R', 'P', 'W', 'W', 'P', 'R', 'R', 'R')
  3.  
  4. def rotate(bouquet, k):
  5.     new = ()
  6.     l = len(bouquet)
  7.  
  8.     for i in range(l):
  9.         new += (bouquet[(i+k)%l],)
  10.  
  11.     return new
  12.  
  13. def valentino_rec(bouquet, k):
  14.     l = len(bouquet)
  15.  
  16.     if l == 1:
  17.         return bouquet[0]
  18.  
  19.     else:
  20.         new = rotate(bouquet, k-1)
  21.  
  22.         return new[0] + valentino_rec(new[1:], k)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top