the array order in result from Set's operations. | Sololearn: Learn to code for FREE!
0

the array order in result from Set's operations.

first = {1, 2, 3, 4, 5, 6} second = {4, 5, 6, 7, 8, 9} print(second - first) Is there any means to array like this {8, 9, 7}? why not {7, 8, 9}? Or other patterns.

16th Oct 2017, 6:25 AM
Yan Gao
Yan Gao - avatar
1 Respuesta
+ 9
Set {} is an unordered data type. The order of its elements being printed is random unless handled adequately (sorting, filtering, typecasting, etc.)
16th Oct 2017, 6:43 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar