How to compare all the elements of a list with each other? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátis
0

How to compare all the elements of a list with each other?

How to compare all the elements of a list with each other?

12th Nov 2019, 12:30 PM
Марсель Халимов
9 Respostas
+ 1
Марсель Халимов None represents default value, comp means any comparison based on a[i] and a[j].
12th Nov 2019, 3:10 PM
Seb TheS
Seb TheS - avatar
+ 1
I deleted that invalid junk.
12th Nov 2019, 3:12 PM
Seb TheS
Seb TheS - avatar
+ 1
It creates a 2D list: -1 + + + + ... 2 + + + + 1 + + + + 0 + + + + 0 1 2 ... -1 Which is filled with results of a's values operated with each others.
12th Nov 2019, 3:18 PM
Seb TheS
Seb TheS - avatar
+ 1
Here I created multable, but the operation and list can be changed to any. https://code.sololearn.com/cniZbx4nYXWS/?ref=app
12th Nov 2019, 3:24 PM
Seb TheS
Seb TheS - avatar
+ 1
Марсель Халимов (None is left when item is compared with itself), but here: https://code.sololearn.com/ceSiOb6byVJC/?ref=app
12th Nov 2019, 4:02 PM
Seb TheS
Seb TheS - avatar
0
What does mean None and comp in your code
12th Nov 2019, 3:04 PM
Марсель Халимов
0
And I should compare all the elements and find out how many similar items are there
12th Nov 2019, 3:10 PM
Марсель Халимов
0
So how it is does
12th Nov 2019, 3:13 PM
Марсель Халимов
0
find out how many similar items are there
12th Nov 2019, 3:13 PM
Марсель Халимов