From 6a94760259170d02b73af5c731000bd41686f5ef Mon Sep 17 00:00:00 2001 From: tnbeats <tnbeatsprod@gmail.com> Date: Fri, 13 Oct 2023 23:06:49 +0200 Subject: [PATCH] 22211572 --- 2.7 Exercises.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/2.7 Exercises.py b/2.7 Exercises.py index 91b1cd5..96485ae 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) -- GitLab