I tried looking at this but to no avail, heres the code I made from the link.
game = 1
while game == 1:
print('WORLD EVALUATOR 2000')
word = input("Insert some text...").lower()
words = word.split(" ")
lastWord = words[-1]
if word[0].lower() in 'aeiou':
print("The string begins with a vowel")
elif word[0].lower() in '1234567890':
print ("The string begins with a number")
elif word[0].lower() in 'bcdfghjklmnpqrstvwxyz':
print ("The string begins with a consonant")
elif word[0].lower() in '!@#$%^&*()_+{}|:"<>?':
print ("The string begins with a symbol or a space.")
elif word[0].lower() in ' ':
print ("The string begins with a space.")
else:
print("The string does not begin with a vowel,number, consonant, space, or a symbol")
if word[1].lower() in 'aeiou':
print("The string's second letter is a vowel")
elif word[1].lower() in '1234567890':
print ("The string's second letter is a number")
elif word[1].lower() in 'bcdfghjklmnpqrstvwxyz':
print ("The string's second letter is a consonant")
elif word[1].lower() in '!@#$%^&*()_+{}|:"<>?':
print ("The string's second letter is a symbol or a space.")
elif word[1].lower() in ' ':
print ("The string's second letter is a space.")
else:
print("The string's second letter is not a vowel,number, consonant, space, or a symbol")
if lastWord[-1].lower() in 'aeiou':
print("The string's last letter is a vowel")
elif lastWord[-1].lower() in '1234567890':
print("The string's last letter is a number")
elif lastWord[-1].lower() in 'bcdfghjklmnpqrstvwxyz':
print("The string's last letter is a consonant")
elif lastWord[-1].lower() in '!@#$%^&*()_+{}|:"<>?':
print("The string's last letter is a symbol or a space.")
elif lastWord[-1].lower() in ' ':
print("The string's last letter is a space.")
else:
print("The string's last letter is not a vowel,number, consonant, or a symbol")
print("The string is " + str(len(words)) + ' letters/numbers/symbols long.')
Near the end is where I used len but it isn't working, could I have some help?
If anyone asks, the while loop isn't properly indented because of the formatting in stackoverflow hating me. In reality the loop works fine expect for the len part.