Write a function that takes a dictionary and prints all of its items (key-value pair),
one per line, in the following format:
key1 value1
key2 value2
...
Example:
>>> print_dict({'one': 1, 'two': 2}
'one' 1
'two' 2
Write a function which takes a string, s, as argument, and prints only its characters with index less than 5 (not including 5).
Write a function that a list of strings and returns a string which is concatenation of all
list items with space in between of each.
Example:
>>> add_strings(["it's", "a", "fugazi"])
"it's a fugazi"
Write a function that takes a dictionary and another argument, d and k,
and returns the value of d mapped to k. Example:
>>> get_value({'one': 1, 'pse': 'ani'}, 'pse')
'ani'
Write a function which takes one dictionary and removes the item with key 'pse' from it.
Example:
>>> person = {'name': 'Astrit', 'pse': 'per qef'}
>>> remove_pse(person)
>>> person
{'name': 'Astrit'}
integers = [4, 44, 333]
Modify integers by dividing by 4 each element of it using for.
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: |
d = {'one': 1}
a = 1 in d
b = 'one' in d
d['pse'] = 3
v = d['pse']
Given the above script?
| What is the final value of d: | ||
| What is the final value of a: | ||
| What is the final value of b: | ||
| What is the final length of d: | ||
| What is the final value of v: |
Complete execution flow of the following program
def return_char(s, n): index = len(s) - n return s[index] first = return_char('boletin', 2) second = return_char('prishtine', 1)
Complete execution flow of the following program
def return_char(s, n): return s[n] return_char('owling', -2) return_char('bowling', -4)