Write a function that takes a list of (name, age) tuples and
returns only the names of people who are 18 or older. Keep the same order of the names.
Example:
>>> adults([("Mar", 3), ("Bert", 18), ("Berat", 19)])
['Bert', 'Berat']
Write a function that takes a string and prints only its vowels.
Note: Vowels in english are aeiou.
Example:
>>> print_vowels("inai ANI")
i
a
i
A
I
Write a function, get_most_common_words, that takes a histogram
(dictionary of words and their frequencies) and returns a list of
(count, word) tuples, sorted from the most frequent to least.
Example:
>>> get_most_common_words({'again': 1, 'hello': 2, 'world': 1})
[(2, 'hello'), (1, 'world'), (1, 'again')]
Write a function that takes a dictionary and prints all its values, one per line.
Write a function, two_vowel_words(words),
which returns all words from a list that contain exactly two different vowels.
The output list should save the order of the input list
Vowels are: aeiou
Example:
>>> two_vowel_words(['team', 'boat', 'read', 'ski', 'cat'])
['team', 'boat', 'read']
Write a function which takes a string and prints all its letters and their indices,
in the order that they appear, each in a new line. Example:
>>> traverse_string('ani')
0 a
1 n
2 i
def dosmth(lst):
v = lst[0]
for index in range(len(lst) - 1):
lst[index] = lst[index + 1]
lst[-1] = v
nums = [1, 2, 3, 4]
dosmth(nums)
What is the value of nums at the end of execution of the above script?
def dosmth(lst):
for index in range(len(lst) - 1):
lst[index] = lst[index + 1]
lst[-1] = lst[0]
nums = [1, 2, 3, 4]
dosmth(nums)
What is the value of nums at the end of execution of the above script?
Complete execution flow of the following program
Complete execution flow of the following program
t = ['pse', 'po', 'ani'] a = t.remove('po') print(a)