Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PyTHON How do you add a new key-value pair, key = ''week4, value = 4.0, to an existing dictionary named cs410? Select one: a. cs410('week4')

PyTHON

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

Select one:

a.

cs410('week4') = 4.0 

b.

cs410['week4'] = 4.0 

c.

cs410.add(['week4', 4.0]) 

d.

cs410{'week4'} = 4.0 

e.

cs410.add('week4', 4.0) 

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:

tuple('informatics') 

Select one:

a.

('informatics') 

b.

['i', 'n', 'f', 'o', 'r', 'm', 'a', 't', 'i', 'c', 's'] 

c.

['informatics'] 

d.

{'i', 'n', 'f', 'o', 'r', 'm', 'a', 't', 'i', 'c', 's'} 

e.

('i', 'n', 'f', 'o', 'r', 'm', 'a', 't', 'i', 'c', 's') 

Suppose we have two lists l1 and l2:

l1 = [1, 2, 3] l2 = ['a', 'b', 'c'] 

Now let's do:

l3 = list(zip(l1,l2)) 

What is the second element in l3?

Select one:

a.

(2, 'b') 

b.

(1, 'b') 

c.

[2, 'a'] 

d.

{1:'b'} 

e.

[2, 'b'] 

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.

d.values() 

b.

d.items() 

c.

d.item() 

d.

d.pairs() 

e.

d.keys() 

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

a, b = b, a 

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions