Skip to main content
Improvment of score + extra language
Source Link
Kroppeb
  • 1.8k
  • 10
  • 11

Python 3, 8080 78 bytes

I don't realy do many python code golfs but I thought I could give it a try

  • -2 bytes: realised not(any()) is the same as all(not()) and could move the not into the r-string
def f(x):*l,=map(r'_/\~'.find,x);return 1-any((i^j//2)%2for i,j in zip(l,l[1:])) 

Try it online!Try it online!

Python 3.8 (pre-release), 71 bytes

I wanted to try out the new := expression assignment

lambda x:all((i^j//2)%2for i,j in zip(l:=[*map(r'\~_/'.find,x)],l[1:])) 

Try it online!

Python 3, 80 bytes

I don't realy do many python code golfs but I thought I could give it a try

def f(x):*l,=map(r'_/\~'.find,x);return 1-any((i^j//2)%2for i,j in zip(l,l[1:])) 

Try it online!

Python 3, 80 78 bytes

I don't realy do many python code golfs but I thought I could give it a try

  • -2 bytes: realised not(any()) is the same as all(not()) and could move the not into the r-string
def f(x):*l,=map(r'_/\~'.find,x);return 1-any((i^j//2)%2for i,j in zip(l,l[1:])) 

Try it online!

Python 3.8 (pre-release), 71 bytes

I wanted to try out the new := expression assignment

lambda x:all((i^j//2)%2for i,j in zip(l:=[*map(r'\~_/'.find,x)],l[1:])) 

Try it online!

Source Link
Kroppeb
  • 1.8k
  • 10
  • 11

Python 3, 80 bytes

I don't realy do many python code golfs but I thought I could give it a try

def f(x):*l,=map(r'_/\~'.find,x);return 1-any((i^j//2)%2for i,j in zip(l,l[1:])) 

Try it online!