You are viewing a single comment's thread. Return to all comments →
def funnyString(s): r=s[::-1] x=list(s) a=list(r) for i in range(len(x)): x[i]=ord(x[i]) for j in range(len(a)) : a[j]=ord(a[j])
i=0 j=1 while j<len(x): x[i]=abs(x[j]-x[i]) a[i]=abs(a[j]-a[i]) i=j j=j+1 x.pop(j-1) a.pop(j-1) if x==a: return "Funny" else: return "Not Funny"
Seems like cookies are disabled on this browser, please enable them to open this website
Funny String
You are viewing a single comment's thread. Return to all comments →
VERY EASY SOLUTION **
def funnyString(s): r=s[::-1] x=list(s) a=list(r) for i in range(len(x)): x[i]=ord(x[i]) for j in range(len(a)) : a[j]=ord(a[j])