Question

Assume that the variable data refers to the dictionary {'b':20, 'a':25}, Write the values of the...

Assume that the variable data refers to the dictionary {'b':20, 'a':25}, Write the values of the following expressions:

a. data['a']

b. data. get ('c', None)

c. len(data)

d. data.keys()

e. data.values()

f. data.pop('b')

g. data # after the pop above

0 0
Add a comment Improve this question Transcribed image text
Answer #1
a. data['a']
Answer:
25

b. data. get ('c', None)
Answer:
data will be {'b': 20, 'a': 25}

c. len(data)
Answer:
2

d. data.keys()
Answer:
dict_keys(['b', 'a'])

e. data.values()
Answer:
dict_values([20, 25])

f. data.pop('b')
Answer:
20

g. data # after the pop above
Answer:
{'a': 25}
Add a comment
Know the answer?
Add Answer to:
Assume that the variable data refers to the dictionary {'b':20, 'a':25}, Write the values of the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • pls help python is to be used Assume that the variable data refers to the list...

    pls help python is to be used Assume that the variable data refers to the list [5, 3, 7]. Write the value of the following expressions for questions 48-49. 48. (I points) datal-1] Answer: 49. (1 points) 0 in data Answer: 50. (4 points) Given my_dict = {'a':3, 'x':7, 'r':5}, write Python code to print all the key and value pairs of my_dict. Answer:

  • Which of the statements about dictionary Values is false? a. Values of a dictionary must be...

    Which of the statements about dictionary Values is false? a. Values of a dictionary must be unique b. Values of a dictionary can be a mixture of letters and numbers c. More than one Key can have the same value d. The value of the dictionary d for Key k can be accessed as d[k] Consider the following Python statement y = " this is quiz number 4".split() What is the data type of the variable y ? a. list...

  • Assume the variable f refers to the Python implementation of a continuous real function (i.e., f...

    Assume the variable f refers to the Python implementation of a continuous real function (i.e., f accepts a single float as input and returns a single float as output), and a and b refer to two float values. Write a Python expression that refers to True if and only if the function represented by f changes its sign between a and b, i.e., the sign of f(a) is different from the sign of f(b). (We define the sign of a...

  • Using Python, Implement a function that returns an opposite of a dictionary: In order to decrypt...

    Using Python, Implement a function that returns an opposite of a dictionary: In order to decrypt the encrypted text, we will use the opposite of the substitution dictionary. Opposite dictionary of a dictionary is the dictionary where each value is the key and the key is the value. For instance, for the dictionary above, its opposite dictionary is {'I': 'A', 'T': 'B', 'R': 'C', 'A': 'D', 'N': 'E', 'S': 'F', 'L': 'G', 'O': 'H', 'M': 'I', 'W': 'J', 'U': 'K',...

  • I need help writing these : Given a dictionary gradeCounts = { "A": 8, "D": 3,...

    I need help writing these : Given a dictionary gradeCounts = { "A": 8, "D": 3, "B": 15, "F": 2, "C": 6} write the Python statement(s) to print: a. all the keys. b. all the values. c. all the key and value pairs. d. all of the key and value pairs in key order. e. the average value. f. a chart similar to the following in which each row contains a key followed by a number of asterisks equal to...

  • Solely from a measurement theory perspective, a good measure should have: 6. Objectivity Reliability Validity b....

    Solely from a measurement theory perspective, a good measure should have: 6. Objectivity Reliability Validity b. C d All of the above Some of the above but not all e. validity refers to validity that is concerned with generalization of the study to the larger population whereas 7, validity refers to validity associated with quantification of the dependent variables. External, Measurement a Convergent, Predictive Construct, external C d Predictive, convergent 8. Operationalization in research most often involves: Using a dictionary...

  • _________ refers to the use of sample data to calculate a range of values that is...

    _________ refers to the use of sample data to calculate a range of values that is believed to include the value of the population parameter. a. Statistical inference b. Hypothesis testing c. Interval estimation d. Point estimation

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

  • The following information refers to questions 18 and 19 .Assume a U.S.-based MNC is borrowing Romanian...

    The following information refers to questions 18 and 19 .Assume a U.S.-based MNC is borrowing Romanian leu (ROL) at an interest rate of 8% for one year. Also assume that the spot rate of the leu is $.00012 and the one-year forward rate of the leu is $.00010. The expected spot rate of the leu one-year from now is $.00011. 18) What is the effective financing rate for the MNC assuming it borrows leu on a covered basis? a) 10%...

  • 7. For a discrete random variable, the set of possible values is a. an interval of...

    7. For a discrete random variable, the set of possible values is a. an interval of real numbers. b. a set of numbers that is countable. c. a set of numbers that has a finite number of numbers. d. none of the above. 8. Let X be a continuous random variable, then P( X = 0) is a. 0.00001. b. zero. c. can be large in some random variable. d. none of the above. 9. For a discrete random variable,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT