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 that takes a list and prints all of its elements in the order that they appear, each in a new line.
Complete execution flow of the following program
t = [1, 2, ['po', 'jo']] d = t[-1].pop(-1) print(d) print(t)
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')]
users = {
"Alice": {
"Inception": {"rating": 9, "review": "Mind-bending!"},
"Titanic": {"rating": 7, "review": "Too long, but emotional"}
},
"Bob": {
"Inception": {"rating": 8, "review": "Loved the visuals"},
"Interstellar": {"rating": 10, "review": "Masterpiece"}
}
}
Write a function, update_review(user:str, movie: str, review: str, users: dict),
that updates a user's review for a given movie.
If the movie or user doesn't exist, do nothing. Example:
>>> update_review("Alice", "Inception", "Amazing concept!", users)
>>> print(users["Alice"]["Inception"])
{'rating': 9, 'review': 'Amazing concept!'}
Define a function that takes one list and a value, t and v, and changes its second to last (the one before the last) element to v.
first = [['a', 'b'], ['c', 'd']] second = [['c', 'd'], ['a', 'b']] a = first[0] + second[0] b = second[1] + first[-1]
What is the value of a and b at the end of execution of the above script?
| a: | ||
| b: |
def dosmth(s):
return s.split('-')
x, y = dosmth('120-130')
Given the above script, what are the values of the following variables?
| x: | ||
| y: |
Complete execution flow of the following program
Complete execution flow of the following program
def return_char(s, n): return s[n] return_char('mendora', -1) return_char('mendora', -3)