please help 6. Given dict_var = {‘a’ : 3, ‘x’ : 7, ‘r’ : 5}. (a) Write Python co
ID: 3775347 • Letter: P
Question
please help
6. Given dict_var = {‘a’ : 3, ‘x’ : 7, ‘r’ : 5}.
(a) Write Python code that returns the value at key ‘x’.
(b) Write Python code that returns the key given value ‘7’.
7. If dict_var = {‘a’ : 15, ‘c’ : 35, ‘b’ : 20}, write Python code
(a) to print all the keys
(b) to print all the values
(c) to print all the keys and values pairs
(d) to print all the keys and values pairs in order of key
(e) to print all the keys and values pairs in order of value
8. If set_one = ‘bcd’, and set_two = ‘abcde’
(a) What is the value of set_one.issubset (set_two) ?
(b) What is the value of set_two.issubset (set_one) ?
9. Write a function power that takes in a base and an exp and recursively computes baseexp. You are not allowed to use the ** operator.
10. Provide two small numbers for base and exp in function power, and draw the figure to trace the recursive function calls.
17 0/2 points l Previous Answers LarCalc 10 13.6.027 Find the gradient of the function at the given point. Function Point 4, 3 f(x, y) X2 2Xy Vf( 4, 3 Find the maximum value of the directional derivative at the given point.Explanation / Answer
8) a. true
b. false
7)
a. dict_var.keys();
b. dict_var.values()
c. dict_var.items()
d. sorted(dict_var.keys())
e. sorted(dict_var.values())
6)
a. dict_var.get('x')
b.
for name in dict_var:
if dict_var[name] == 7:
print name
break
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.