Write a function which takes two dictionaries and removes all of their items.
Write a function that takes a list of tuples (name, grade) and
returns a list of names who passed (grade >= 60). Keep the same order.
Example:
>>> passed_students([("Laura", 60), ("Fitorja", 59), ("Merita", 75)])
['Laura', 'Merita']
Write a function that takes a string and prints only uppercase letters.
Example:
>>> print_uppercases("iAnai B")
A
B
Write a function that takes a dictionary and two other arguments, d, k and v,
and adds a new item to d with key k and value v. Example:
>>> d = {"tree": "fruit"}
>>> add_value(d, "cow", "milk")
>>> d
{"tree": "fruit", "cow": "milk"}
Define a function that takes one list, and prints all its elements, one per line.
Write a function, display_user_books, that takes a user and the borrowed dictionary,
and prints the books borrowed by that user. Example:
>>> borrowed = {'Alice': ['1984']}
>>> display_user_books("Alice", borrowed)
Alice has borrowed:
- 1984
>>> borrowed = {}
>>> display_user_books("Alice", borrowed)
Alice has not borrowed any books.
def pse(a, b): return a[3] < b[2]
Given the above script, what are the results of the following expressions:
pse('Pobre', 'Johejdi'): | ||
pse('psespodon', 'sdumore'): |
def dosmth(d, a): return d.pop(a, 'ska') questions = {'ku': 'qaty', 'pse': 'sdi', 'jo be': 2} a = dosmth(questions, 'ska') 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
def dosmth(s, i): index = 0 while index < len(s): if index == i: return s[i] index = index + 1 dosmth('pst', 1)
Complete execution flow of the following program
def get_length(s): return len(s) def get_indices(s): return range(get_length(s)) def concat(s, n): w = "" for i in get_indices(s): if i % n == 0: w = w + s[i] return w d = concat("benve", 2)