Define a function that takes one list, and prints all its elements, one per line.
Write a function that takes a list and a value (of whatever type), t and v, and appends
v to t.
>>> t = [1, 'ani']
>>> append_to_list(t=t, v=3)
>>> t
[1, 'ani', 3]
>>> append_to_list(t=t, v=[1, 2])
>>> t
[1, 'ani', 3, [1, 2]]
Write a function, uses_all(word, required), that returns True if word uses all characters from the required string.
Create two lists and assign them to a and b respectively.
Concatenate a and b and assign it to c.
Repeat c 3 times and reassign.
Print c.
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
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": 8, "review": "Masterpiece"},
"The Shawshank Redemption": {"rating": 10, "review": "Masterpiece"}
}
}
Write a function, get_most_active_user(users: dict), that returns the name of the user
who has rated the most movies. Example:
>>> get_most_active_user(users)
'Bob'
def dosmth(d, a):
return d.pop(a)
questions = {'ku': 'qaty', 'pse': 'sdi', 'jo be': 2}
a = dosmth(questions, 'ku')
b = dosmth(questions, 'pse')
What is the value of the following variables at the end of the execution of the above script?
| a: | ||
| b: | ||
| questions: |
def dosmth(d, a):
return d.pop(a, None)
questions = {'ku': 'qaty', 'pse': 'sdi', 'jo be': 2}
a = dosmth(questions, 'ku')
b = dosmth(questions, 'ani')
What is the value of the following variables at the end of the execution of the above script?
| a: | ||
| b: | ||
| questions: |
Complete execution flow of the following program
d = {12: 'ab', 23: 'bc'} for key in d: if str(key)[0] == "2": print(key)
Complete execution flow of the following program