python questions

1.What is the value of the following expression:

sеt (rаngе (0, 20, 3)) & sеt (rangе (0, 20, 2))

{0, 6, 12, 18}

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写{0, 2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18}

{3, 9, 15}

{2, 3, 4, 8, 9, 10, 14, 15, 16}

. 2.

Which operators are applicable to sets? (Check all that apply.)

+

*

&

|

^

/

in

. 3.

Which expression correctly changes the tail (the last element) of the middle item in the following

tuple:

foo=(12, [“a”, “n”, “d”, “y”], set (“andy”))

foo[1][-1] = “a”

foo[0][0] = “a”

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写Tuples are immutable and cannot be changed.

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写The tuple foo has items of different data types and is illegal.

. 4.

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写Which data type cannot be used as a key in a dictionary?

list

int

float

string

. 5.

Which data structures could be used instead of the following dictionary without any loss of

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写information and functionality, including possible modifications both of element names and their

weights?

elements = {“H” : 1, “He” : 4, “Li” : 7, “Be” : 9}

names = [“H”, “He”, “Li”, “Be”]

weights =

Leave a Reply

Your email address will not be published. Required fields are marked *