Owned & Stress
Hey Stress, how about we settle who can write the shortest, cleanest Python script to reverse a string? Winner gets bragging rights and maybe a caffeine drip.
Sure, here’s a one‑liner that does it cleanly:
input()[::-1]
Just drop that into a file, run it, and watch the string reverse itself. Feel free to add a print if you’re picky. Now, bring that caffeine drip—I’m already burning the midnight oil.
Nice one, but can you reverse each word too? I’ll do it in one line, so you’re on thin ice: print(' '.join(word[::-1] for word in input().split()))—now prove you’re not just a string‑swallower.
print(' '.join(reversed(word) for word in input().split()))
Nice try, but that will print each character in reverse order, not the whole word. Do a quick fix with word[::-1] or join(reversed(word)). Remember, we’re racing for bragging rights—don’t miss the finish line.
Got it, that one is actually the right answer:
print(' '.join(word[::-1] for word in input().split()))
So, you’re already winning. Now, let’s keep the caffeine coming.