a = {1, 2, 3} b = {0, 3, 4, 5} print(a & b) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

a = {1, 2, 3} b = {0, 3, 4, 5} print(a & b)

my answer is {3} but its need for 2 more answer any one can help?

2nd Jan 2023, 4:17 PM
Mohammad Abed Kapisawal
4 Answers
+ 8
rad , can you please complete your question: > give a complete task description what the code should do.
2nd Jan 2023, 4:26 PM
Lothar
Lothar - avatar
+ 1
a = {1, 2, 3} b = {0, 3, 4, 5} print(a & b) # anser: { 3 } # Each character must be entered separately
23rd Mar 2023, 11:01 PM
المهندس أحمد
المهندس أحمد - avatar
+ 1
You answered {3} but there were room for 2 more characters to type in the answer input box. That was because it expected {3.0} as answer. I cannot quite explain why. Maybe someone with more knowlwdge can confirm these overloads for bitwise operators always store the results in `float` even though both operands only contain integers in this case.
24th Mar 2023, 11:11 AM
Ipang
+ 1
{ 3 }
11th Aug 2023, 9:14 AM
Fernando Donizeti Ito
Fernando Donizeti Ito - avatar