Can Anyone help me with the error in the code?


#1
##I want this program to print number of vowels .. it is'nt doing so:
##Number of vowels
word = input("Enter a word:")
num_vowel = 0
vowel = ("a","e","i","o","u","A","E","I","O","U")
for i in range (0, len(word)-1):
    if word[i] in vowel:
        num_vowel =+1
print ("The word has " +str( num_vowel) , "vowels")

#2

why use range() here? It doesn’t add value, it just obscures the code

to update/increase a value we can do:

x = x + 1

which we can shorten to:

x += 1

which is not what you are doing

here:

print ("The word has " +str( num_vowel) , "vowels")

you attempt to concatenate a string and a variable, but you use both a plus sign and a comma. Which one is it?