From fbb2af09d45eddd2df6e96cd988e87b162739672 Mon Sep 17 00:00:00 2001 From: s4tt4r <91577493+s4tt4r@users.noreply.github.com> Date: Wed, 29 Sep 2021 06:33:14 +0300 Subject: [PATCH 1/2] the_answer.py it's not my code i wasn't know anything about the subject but i tried to understand whatever i can *my main issue in the code is how to get an input either from the user or initial value --- python-pass.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/python-pass.py b/python-pass.py index dbf8e87..43eb93f 100644 --- a/python-pass.py +++ b/python-pass.py @@ -1,7 +1,20 @@ - - -class Solution: - +class Soulution: @staticmethod - def longest_palindromic(s: str) -> str: - pass + def longestpalindrome (self, s:str) ->str: + + def holder(l,r): + while(l >= 0 and r < len(s) and s[l] == s[r]): + l -= 1 + r += 1 + return s[l+1 : r] + result = "" + for i in range(len(s)): + test = holder(i,i) + if len(test) > len (result): result = test + + return result + def results(self, s:str) : + + answer = Soulution().longestpalindrome() + print (answer) + results("babad") From dfc12880a6cc8dd90f7d5d036dbb46eea11dcbec Mon Sep 17 00:00:00 2001 From: s4tt4r <91577493+s4tt4r@users.noreply.github.com> Date: Wed, 29 Sep 2021 15:03:58 +0300 Subject: [PATCH 2/2] update python.py i forgot to add the gmail --- python-pass.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-pass.py b/python-pass.py index 43eb93f..185c387 100644 --- a/python-pass.py +++ b/python-pass.py @@ -18,3 +18,5 @@ def results(self, s:str) : answer = Soulution().longestpalindrome() print (answer) results("babad") + + #my gmail is iam.satar.moh@gmail.com