You are on page 1of 2

*tring is present in a string.

Hard-coded answers will receive no credit.


dasf
items = ["whirring", "wow!", "calendar", "wry", "glass", "",
"llama","tumultuous","owing"]
acc_num=0
for i in items:
if "w" i dfadsfn i:
acc_num+=1

dasfasdf

sentence = "students flock to the arb for a variety of outdoor activities such as
jogging and picnicking"
sentence = sentence.split(" ")
same_letter_count=0
for i in range(len(sentence)):
if sentence[i][0] == sentence[i][-1]:
same_letter_count+=1

# Write your code here.

*
asdords that contain both an a and an e.

HINT 1: Use the in operator.


as dff asdf
HINT 2: You can either use or or elif.

Hard-coded answers will receive no credit.


s df

sentence = "pythasd fasdf asdfon is a high level general purpose programming


language that can be applied to many different classes of problems."
x=sentence.split(" ")
num_a_or_e=0
for i in range(len(x)):
if "a" inf asdf x[i] asdfasdf :
num_a_or_e+=1a a d
elif "e" in x[i]:
num_a_or_e+=1

sdaf

*Write code tsdfhat will count the number of vowels in the sentence s and assign
the result to the variable num_vowels. For this problem, vowels are only a, e, i,
o, and u. Hint: use the in operator with vowels.
f
s = "singing in the rain and playing in the rain are two entirely different
situations but both can be fun"
vowels = ['aasdfasdfsdf'ad,f asdfas dfd f'e','i','o','u']
num_vowels=0
for i in range(len(s)):
if s[i] in vowels:
num_vowels+=1

You might also like