diff --git a/2.7 Exercises.py b/2.7 Exercises.py index 91b1cd57043f22fafd9b81f6b78ee3a7fcc22499..96485ae83630d1efcc6820bb3aaed224565a43c0 100644 --- a/2.7 Exercises.py +++ b/2.7 Exercises.py @@ -3,17 +3,9 @@ def rotateR(val): return val[-1] + val[:-1] if len(val) > 0 else None - - - - - - - # question 4 def rotateRx(val): - pass - + val[:] = [val[-1]] + val[:-1] # question 5 @@ -25,5 +17,20 @@ def rotateRx_modified(val): pass # question 6 + + def rotateR2(val): return rotateR(rotateR(val)) + + +# question 7 +def rotateRx2(val): + rotateRx(val) + rotateRx(val) + + +# question 8 +l = [[1, 2, 3]] * 2 +print(l) +rotateRx(l[1]) +print(l)