Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

What is the value of pairs after the following assignment?
pairs = [ (x,y) for x in range(4) for y in range(3) if (x+y)%3 == 0 ]
What is the value of pairs after the following assignment?

pairs = [ (x,y) for x in range(4) for y in range(3) if (x+y)%3 == 0 ]
Assume that d has been initialized as an empty dictionary:
d = {}
Which of the following generates an error?
d[[1,2]] = 5
d[(1,2)] = 5
d["1,2"] = 5
d[12] = 5
Consider the following dictionary.
marks = {"Quizzes":{"Mahesh":[3,5,7,8],"Suresh":[9,4,8,8],"Uma":[9,9,7,6]},"Exams":{"Mahesh":[37],"Uma":[36]}}
Which of the following statements does not generate an error?
marks["Exams"]["Suresh"].extend([44])
marks["Exams"]["Suresh"] = [44]
marks["Exams"]["Suresh"].append(44)
marks["Exams"]["Suresh"][0:] = [44]
What is the value of pairs after the following assignment?
pairs = [ (x,y) for x in range(4) for y in range(3) if (x+y)%3 == 0 ]
Consider the following Python function.
def mystery(l):
if l == []:
return (l)
else:
return (l[-1:] + mystery(l[:-1]))
What does mystery([13,23,17,81,15]) return
Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l.
Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n.
Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l.

Here are some examples to show how your function should work.

>>> sumprimes([3,3,1,13])
19
>>> sumprimes([2,4,6,9,11])
13
>>> sumprimes([-3,1,6])
0
What is the value of h(231,8) for the function below?
def h(m,n):
ans = 0
while (m >= n):
(ans,m) = (ans+1,m-n)
return(ans)
LATEST TUTORIALS
APPROVED BY CLIENTS