I've literally just started learning to code so very inexperienced, and I probably haven't done this the best way - I'm trying to write code in Python that will count the number of DIFFERENT vowels in a string (i.e. if the input was 'Hello my name is Simon' the output should be '4' as the string contains a, e, i and o)
a="a"
A="A"
e="e"
E="E"
i="i"
I="I"
o="o"
O="O"
u="u"
U="U"
num_of_diff_vowels=0
print("This program will count the number of vowels in your string")
ans = input("Enter string here:")
if a or A in ans:
num_of_diff_vowels=num_of_diff_vowels+1
if e or E in ans:
num_of_diff_vowels=num_of_diff_vowels+1
if o or O in ans:
num_of_diff_vowels=num_of_diff_vowels+1
if i or I in ans:
num_of_diff_vowels=num_of_diff_vowels+1
if u or U in ans:
num_of_diff_vowels=num_of_diff_vowels+1
print(num_of_diff_vowels)
So far with this code all I'm getting in the output is '5'... Any ideas of how to refine this and actually make it work?