Repeated Start

Sometimes you need to check whether the beginning of a string appears again at the end, which helps find simple patterns and matches. Write a function front_again that takes a string s and compares its first two characters with its last two characters. Return True if they are the same, otherwise return False.

Примеры

Ввод
"edited"
Вывод
True
Ввод
"edit"
Вывод
False
Ввод
"ed"
Вывод
True

Нужно реализовать

def front_again(s: str) -> bool:

Теги

strings
PostgreSQLv16

Siia ilmub koodi käivituse tulemus

Visible tests
1
Input
"edited"
ExpectedTrue
2
Input
"edit"
ExpectedFalse
3
Input
"ed"
ExpectedTrue
4
Input
"abcab"
ExpectedTrue
5
Input
"a"
ExpectedFalse
6
Input
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ExpectedTrue
Focus radio
Paused · SomaFM · Fluid