- A five letter word is printed by the code below, what is it?
words = ["self", "contained", "underwater", "breathing", "apparatus"]
abb = ""
for w in words:
abb = abb + w[1]
print abb
- The code below prints 4, modify it in a good way
to print 4.5 which is arguably a
"better" value.
nums = [4,5,4,5,4,5,4,5]
total = sum(nums)
print total/len(nums)
- What does this function do?
def changeup(s):
answer = ""
for ch in s:
answer = answer + ch*2
return answer
- Complete the function below.
def is_vowel(ch):
'''
returns True if ch is a vowel (a, e, i, o or u)
else returns False
'''
- Complete the function below. (WE DIDN"T GET TO THIS ONE)
def allvowels(word):
"""
returns true if the word is all vowels
returns false otherwise
"""