Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PyTHON How do you add a new key-value pair, key = \'\'week4\", value = 4.0, to a

ID: 3887759 • Letter: P

Question

PyTHON

How do you add a new key-value pair, key = ''week4", value = 4.0, to an existing dictionary named "cs410"?

Select one:

a.

b.

c.

d.

e.

A dictionary is a(n) _________ sequence that can hold values that are referenced by corresponding keys. It is a(n) _________ from keys to their corresponding values.

Select one:

a. unordered, link

b. unordered, mapping

c. ordered, link

d. ordered, mapping

In a dictionary, the key-value pairs are separated by _____, and the value is separated from its key by a _____.

Select one:

a. colons, period

b. commas, hyphen

c. commas, colon

d. periods, semicolon

e. periods, semicolon

What is the output of:

Select one:

a.

b.

c.

d.

e.

Suppose we have two lists l1 and l2:

Now let's do:

What is the second element in l3?

Select one:

a.

b.

c.

d.

e.

The "random.random()" function is NOT a truly __________ function because it generates __________ numbers.

Select one:

a. deterministic, pseudorandom

b. nondeterministic, random

c. nondeterministic, pseudorandom

d. deterministic, random

Which of the following function returns the key-value pairs from an existing dictionary named "d"?

Select one:

a.

b.

c.

d.

e.

Suppose a=4, b=9. What are the new values of a and b if we execute the following code?

Select one:

a. a=4, b=9

b. a=4, b=4

c. a=9, b=9

d. a=9, b=4

The important difference between tuples and lists is that tuples are _________.

Select one:

a. immutable

b. mutable

c. unordered

d. ordered

Which of the following data types is NOT hashable?

Select one:

a. float

b. integer

c. string

d. dictionary

Explanation / Answer

d. a=9, b=4 (It will be swapped)

The important difference between tuples and lists is that tuples is immutable

Which of the following data types is NOT hashable?

d. dictionary

Thanks, let me know if there is any doubts