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

2 of 6
deleted 1 character in body
FlipTack
  • 14.7k
  • 3
  • 56
  • 102

Python 3, 58 bytes

Working on golfing it down.

I know there are already other Python answers, but I thought I'd post this one too seeing as it scores pretty well compared to the others, despite being a full function and not a lambda.

Takes input as function parameters, and prints to STDOUT.

def f(s,n,i=0):
 for c in s:print(end=[c,c*n][i%n<1]);i+=1

Try it online!

FlipTack
  • 14.7k
  • 3
  • 56
  • 102

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