Sort first.
Extend first to second.
Append a string to second.
Print second.
Write a function that takes a dictionary, d and adds a new item to it
with key "cow" and value "milk". Example:
>>> d = {"tree": "fruit"}
>>> add_value(d)
>>> d
{"tree": "fruit", "cow": "milk"}
Write a function, suggest_best_time, that takes a dictionary, members,
and returns the hour when the most members are available.
If there is a tie, return the earliest hour. Example:
>>> members = {'Alice': {9, 10, 14}, 'Bob': {10, 14, 15}, 'Dan': {10, 14}}
>>> suggest_best_time(members)
10
Write a function which takes two strings, s1 and s2, and it concatenates the first 3
characters of s1 with the last 2 characters of s2 and returns it.
Example:
>>> concatenate_strings("power", "owl")
'powwl'
Write a function, words_with_all(words, required),
which returns a list of words that contain all the required letters. Example:
>>> words_with_all(['plane', 'panel', 'pen', 'lean'], 'pen')
['plane', 'panel', 'pen']
Write a function, least_available_members that takes a dictionary, members,
and returns a list of member names who have the fewest available hours. Example:
>>> members = {'Alice': {9, 10, 14}, 'Bob': {10, 14, 15}, 'Dan': {10, 14}}
>>> least_available_members(members)
['Dan']
d = [2, 2, 1] d.append(4) d.sort() t = d.extend([1, 2])
What is the value of d and t at the end of execution of the above program?
| d: | ||
| t: |
def change(lst, index, value):
lst[index] = value
t = [1, 2, 3]
change(t, 0, 5)
print(t)
change(t, -2, 3)
print(t)
change(t, 1, 10)
print(t)
Given the above script, write the printed values in the order that they appear.
| 1: | ||
| 2: | ||
| 3: |
Complete execution flow of the following program
counter = {'a': 1, 'b': 2} counter['a'] = counter['b'] counter['c'] = counter['a'] + 2 d = counter['b'] + counter['a']
Complete execution flow of the following program