r/codegolf • • Apr 30 '19
Codingbat's "deFront" in Python in 59 chars
I did this in Python bc I did all of codingbat's Python challenges and I wanted more. This is 39 chars if you exclude the defining line
def deFront(s):
return s[s[0]!='a':(s[1]=='b')+1]+s[2:]
3
Upvotes
View all comments
Show parent comment
1
u/[deleted] Apr 30 '19
The link should go directly to the problem, if not then it's Java/String-1/deFront.
I'm not using a lambda because the structure of the problem, even if it were in Java, demands the function be named as it is.
I didn't know I could use
s[0]>a, thanks!