From 14e7dc4f3635172f18f9874eb48f2002342f9947 Mon Sep 17 00:00:00 2001
From: Michael Mutote <130656746+mr1Michael@users.noreply.github.com>
Date: Wed, 11 Oct 2023 20:28:54 +0200
Subject: [PATCH] 22202956 answer 4 was incorrect. removed it. Question 5 done.

---
 2.7 Exercises.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/2.7 Exercises.py b/2.7 Exercises.py
index 459c01f..12622fe 100644
--- a/2.7 Exercises.py	
+++ b/2.7 Exercises.py	
@@ -1,6 +1,6 @@
 # question 1
 def rotateR(val):
-    return val[-1] + val[1:len(val)-1] + val[0]
+    return val[-1] + val[1:len(val)] if len(val) > 0 else None
 
 
 
@@ -12,8 +12,16 @@ def rotateR(val):
 
 # question 4
 def rotateRx(val):
-    val[0], val[-1] = val[-1], val[0]
+    pass
+
 
 
 # question 5
+def rotateRx_modified(val):
+    # cannot be modified to work for strings, without returning a value. Python strings are immutable. They cannot be
+    # modified once they are created:
+    # ```TypeError: 'str' object does not support item assignment```
+    # So the only way to achieve this would be to return a value and assign it back.
+    pass
+
 
-- 
GitLab