paddockpass/edx-python/w1/problem-w1.py
Christopher Talib 041e82774f Adding edx work
2019-07-03 12:20:01 +02:00

16 lines
443 B
Python

# Assume s is a string of lower case characters.
# Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print:
# Number of vowels: 5
s = 'obbbobobkobobonboobldhbobboobybobbobob'
bob = 'bob'
count = 0
for i in range(len(s)):
if s.startswith('bob', i):
count += 1
print("Number of bobs:", count)