SHARE
TWEET

PE

Cloude Feb 21st, 2020 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bouquet = ('R', 'P', 'W', 'W', 'P', 'R', 'R', 'R')
  2.  
  3. def rotate(bouquet, k):
  4.     new = ()
  5.     l = len(bouquet)
  6.  
  7.     for i in range(l):
  8.         new += (bouquet[(i+k)%l],)
  9.  
  10.     return new
  11.  
  12. def valentino_rec(bouquet, k):
  13.     if len(bouquet) == 1:
  14.         return bouquet[0]
  15.     else:
  16.         new = rotate(bouquet, k-1)
  17.         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