0

I can't understand this error

word = input() l=list(word) for i,li in enumerate (l): if(l[i] != "a" & "e" & "i" & "o" & "u"): print(li)

9th Jan 2022, 2:03 AM
Amala Yakin
4 odpowiedzi
+ 1
& is bitwise 'and' The keyword for logical 'and' is "and" Also "e", "i", "o" and "u" are Truthy values To check if 'li' isn't a vocal you could do if li not in "aeiou": print(li)
9th Jan 2022, 2:13 AM
Angelo
Angelo - avatar
0
the problem is in the use of & operator with strings. you can use instead : if l[i] not in "aeiou": print(l[i])
9th Jan 2022, 2:22 AM
YoPycode
0
This code that may help you more: word = list(input( )) for e in word: if e not in "aeiou": print(i)
9th Jan 2022, 2:23 AM
YoPycode
- 1
it should be like: if ( (l[i] != 'a') & (l[i] != 'b') & ... )
9th Jan 2022, 2:13 AM
Slick
Slick - avatar