Python: How would i write this 'if' statement for a word of arbitrary length?
- by ElCarlos
This is what I currently have:
wordlist = [fox, aced, definite, ace]
for word in wordlist:
a = len(word)
if (ord(word[a-(a-1)] - ord(word[(a-a)])) == ord(word[a-(a-2)])-ord(word[a-(a-1)]:
print "success", word
else:
print "fail", word
What I'm trying to do is calculate the ASCII values between each of the letters in…