+ 1

How to Use Array for this Question in python

helloo all i wanna ask... how to make this input ex:AlohaMyNameIsBudi and i want to know how many a e i o u in there with Array this is the output 3(A/a) 1(E/e) 2(I/i) 1(O/o) 1(U/u) using Array and beginner code with python and explanation Thank You :D

15th Oct 2017, 5:25 PM
Jansen Su
Jansen Su - avatar
3 Answers
+ 2
inp = 'AlohaMyNameIsBudi' # it's your input arr = ['a', 'e', 'i', 'o', 'u'] # it's your array inp = inp.lower() # lower() is making all letters are small for x in arr: # for every item in array count = 0 # this variable will count the number of matches for y in inp: # for every item in input if x == y: # if the values are the same count += 1 # that means count = count + 1 print('{0} ({1})'.format(count, x.upper() + "/" + x)) # upper() makes the capital letter
15th Oct 2017, 6:15 PM
Ant
Ant - avatar
+ 1
Not problem!
15th Oct 2017, 6:44 PM
Ant
Ant - avatar
0
waw thank you i try it and it run well, and thanks for the explanation @Ant
15th Oct 2017, 6:23 PM
Jansen Su
Jansen Su - avatar