+ 2
WAP in which you have to find the missing number in an array of 1-100?
3 Réponses
+ 10
# if you have list a = [1, 2, ... 100] then:
if x in set(a):
print('yes') # x in 1-100
else:
print('no') # x there isn't n 1-100
+ 9
array? There is list, set, dict, tuple in Python. No array.
+ 2
# given: list A is the array with the missing number
missing _ number = sum(range(101))-sum(A)
this works if there is only one missing number. see my code as example.