for i in range(len(text)):
if text[i]!= ‘a’ and text[i]!= ‘A’ and text[i]!= ‘e’ and text[i]!= ‘E’ and text[i]!= ‘i’ and text[i]!= ‘I’ and text[i]!= ‘o’ and text[i]!= ‘O’ and text[i]!= ‘u’ and text[i]!= ‘U’ :
At first, I used “if text[i]=! ‘a’ or ‘A’ or…” and obviously it did not work. It took me several minutes to get it clear.
and your question is why
if text[i] != 'a' or 'A' didn’t work?
this is best explained with a joke called:
A wife sends her programmer husband to the grocery store for a loaf of bread…
On his way out she says “and if they have eggs, get a dozen”. The programmer husband returns home with 12 loaves of bread…
this is literally how computers thinks, which is why you experienced problems with your code initialize,
or 'A' simply means: evaluate if
A is true, given we didn’t compare it with anything.
for i in text:
for j in ‘aeiouAEIOU’:
in is certainly a better option indeed