+ 9

Please help me!

How do I define the function remove_extra_n(drones) that takes in a list of drones and returns a new list, containing only 1 occurrence of each item. The order of appearance should be based on the first time each drone occurs.

13th Oct 2017, 9:48 AM
Damaen
Damaen - avatar
2 Answers
+ 6
Define the function is_magic_square(matrix) that will take in a list of lists. If the square is magic, return True, otherwise return False. A square is magic if each cell contains a different integerand the sum of the integers in each row, column and diagonal is equal. matrix: an N by N list of lists. 1x1 e.g. [[1]] 3x3 e.g. [[4,9,2],[3,5,7],[8,1,6]] 4x4 e.g. [[7,12,1,14],[2,13,8,11],[16,3,10,5],[9,6,15,4]] For example,  is_magic_square([[1]]) should return True. is_magic_square([[1,2],[3,4]]) should return False.
13th Oct 2017, 10:31 AM
Damaen
Damaen - avatar
+ 4
print(list(list(set(drones)).sort()))
13th Oct 2017, 10:24 AM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar