Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

4 of 5
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/

#Python 3, (削除) 195 (削除ここまで) (削除) 169 (削除ここまで) (削除) 168 (削除ここまで) 166 bytes

Thanks to @TrangOul for -2 bytes!

How didn't I see that I could have golfed that down before?

x=__import__('string').ascii_letters;y,z=x[26:],x[:26];a,b=y[::-1],z[::-1];print(''.join(b[z.index(i)]if i in b else a[y.index(i)]if i in a else i for i in input()))

(sorta) ungolfed:

x = __import__('string').ascii_letters;
y, z = x[26: ], x[: 26];
a, b = y[::-1], z[::-1];
print(''.join(b[z.index(i)]
 if i in b
 else a[y.index(i)]
 if i in a
 else i
 for i in input()
))

Try it on Ideone!

cat
  • 6.1k
  • 2
  • 27
  • 45

AltStyle によって変換されたページ (->オリジナル) /