تابعی بنویسید که تمام کلمات یک جمله را که با حرف خاصی شروع میشوند، معکوس کند.
نمونه ورودی و خروجی
special_reverse("word searches are super fun", "s") ➞ "word sehcraes are repus fun"
special_reverse("first man to walk on the moon", "m") ➞ "first nam to walk on the noom"
special_reverse("peter piper picked pickled peppers", "p") ➞ "retep repip dekcip delkcip sreppep"
نکات
- فقط کلماتی که با حرف مشخصشده شروع میشوند، معکوس شوند.
- کل جمله معکوس نشود، فقط کلمات مربوطه معکوس شوند.
- تمام کاراکترهای جمله با حروف کوچک نوشته شدهاند.
self.assertEqual(special_reverse("word searches are super fun", "s"), "word sehcraes are repus fun") self.assertEqual(special_reverse("first man to walk on the moon", "m"), "first nam to walk on the noom") self.assertEqual(special_reverse("peter piper picked pickled peppers", "p"), "retep repip dekcip delkcip sreppep")
پاسخ های کاربران به این تمرین
برای مشاهده پاسخ باید ابتدا وارد شده و قفل پاسخ را باز کنید
برای مشاهده پاسخ باید ابتدا وارد شده و قفل پاسخ را باز کنید
نظرات