adplus-dvertising
frame-decoration

Question

What is the output of the code shown below?
s1={3, 4}
s2={1, 2}
s3=set()
i=0
j=0
for i in s1:
    for j in s2:
        s3.add((i,j))
        i+=1
        j+=1
print(s3)

a.

{(3, 4), (1, 2)}

b.

Error

c.

{(4, 2), (3, 1), (4, 1), (5, 2)}

d.

{(3, 1), (4, 2)}

Posted under Python

Answer: (c).{(4, 2), (3, 1), (4, 1), (5, 2)}

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the code shown below?