How many numbers would be printed? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 4

How many numbers would be printed?

a = {1, 2, 3, 4, 5, 6} b = {4, 5, 6, 7, 8, 9} print(a^b) Answer is 6

16th Mar 2020, 11:30 AM
APC (Inactive for a while)
APC (Inactive for a while) - avatar
1 Respuesta
+ 4
You do symmetric difference operation on two sets. Its result is new set with elements which exist in either 1st set or 2nd set but not both 1, 2, 3 are only in 1st set 4, 5, 6 are in both sets. 7, 8, 9 are only in 2nd set so result will be {1, 2, 3, 7, 8, 9} - 6 numbers
16th Mar 2020, 11:54 AM
andriy kan
andriy kan - avatar