Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Three Words by testarossa
def checkio(words):
x = words
y=len(x)
a=0
b=0
d=0
z=""
for i in range(len(x)-1):
if x[i]==" " and x[i-1]>"@" and x[i+1]>"@":
a=a+1
if a==2:
b=2
elif x[i]==" " and x[i-1]<="@" and x[i+1]<="@":
a=0
elif x[i]==" " and x[i-1]>"@" and x[i+1]<="@":
a=0
elif x[i]==" " and x[i-1]<="@" and x[i+1]>"@":
a=0
else:
d=d+4
if b==2:
z= True
else:
z= False
return z
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("Hello World hello") == True, "Hello"
assert checkio("He is 123 man") == False, "123 man"
assert checkio("1 2 3 4") == False, "Digits"
assert checkio("bla bla bla bla") == True, "Bla Bla"
assert checkio("Hi") == False, "Hi"
Nov. 5, 2016