Q101. 입력 받은 영어 문장에서 모음의 개수루ㅡㄹ 구하는 프로그램을 작성하시오.(while) (400점)
s = "Python is widely used by a number of big companies"
i = 0
count = 0
print("모음 : ", end = "")
while i < _________ :
if (s[i] == "a" or s[i] == "A" or s[i] == "e" or s[i] == "E"
or s[i] == "i" or s[i] == "I" or s[i] == "o" or s[i] == "O"
or s[i] == "u" or s[i] == "U") :
count = count + 1
print(________, end=" ")
i = i + 1
print()
print("모음의 개수 : %d" % count)
- 난이도(1~10) : 4
- 힌트 : 없음
- - 실행 결과
-
영어 문장을 입력하세요 : Python is a good language.
모음 : o i a o o a u a e
모음의 개수 : 9
s = "Python is widely used by a number of big companies"
i = 0
count = 0
print("모음 : ", end = "")
while i < len(s):
if (s[i] == "a" or s[i] == "A" or s[i] == "e" or s[i] == "E"
or s[i] == "i" or s[i] == "I" or s[i] == "o" or s[i] == "O"
or s[i] == "u" or s[i] == "U") :
count = count + 1
print(s[i], end =" ")
i = i + 1
print()
print("모음의 개수 : %d" % count)