Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Using ord() solution in Clear category for Three Words by PawlakBartosz43
def checkio(words):
new_word = 1
amount = 0
for i in words: #going through every single character separately
if(ord(i) > 64): #checking if it's a letter
if(new_word == 1):
amount += 1
new_word = 0
else:
if(ord(i) > 47 and ord(i) < 58): #checking if it's a number - if it is, our row of words is broken and we have to start counting over
amount = 0
new_word = 0
else:
if(ord(i) == 32): #checking if it's a space
new_word = 1
if(amount >= 3):
return True #should there be 3 words in a row at any point during the loop we stop the program without checking any further and return true
return False #if the loop ends without having returned true at any point it returns false
Oct. 31, 2016