Write a function that takes a list and sorts it.
>>> a = [4, 3, 1, 2]
>>> sort_list(a)
>>> a
[1, 2, 3, 4]
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
Sort first.
Extend first to second.
Append a string to second.
Print second.
Write a function, common_letters(words), which returns the set of letters
that appear in all words of the list. Example:
>>> common_letters(['hello', 'help', 'helm'])
{'h', 'e', 'l'}
Write a function, avoids, that takes two strings, word and forbidden, and returns True if word doesn't use any of forbidden characters. It returns False otherwise.
Write a function, subtract, that takes two lists of words, list1 and list2, and it returns a list that contains the words from list1 that are not in list2.
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: |
def ani(t):
return t[1][0]
Given the above script, what are the results of the following calls
| ani([[1, 2], [3, 4], 3]): | ||
| ani([[1, 2], [3, 3, 4], 3]): | ||
| ani([['pse'], ['ani'], 3]): |
Complete execution flow of the following program
def is_char(word, ch, i): return word[i] == ch is_char('llapushnik', 'u', 4) is_char('llaushe', 'e', 5)
Complete execution flow of the following program
>>>