یک تابع ایجاد کنید که یک لیست از آیتم را گرفته و بررسی کند که آیا آخرین آیتم با بقیه لیست که به هم متصل شدهاند مطابقت دارد.
نمونه ورودی و خروجی
match_last_item(["rsq", "6hi", "g", "rsq6hig"]) ➞ True
match_last_item([1, 1, 1, "11"]) ➞ False
match_last_item([8, "thunder", True, "8thunderTrue"]) ➞ True
self.assertEqual(match_last_item(["rsq", "6hi", "g", "rsq6hig"]), True) self.assertEqual(match_last_item([1, 1, 1, "11"]), False) self.assertEqual(match_last_item([8, "thunder", True, "8thunderTrue"]), True)
نظرات