We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Passed all test cases. Not the cleanest but I don't see any other python solutions here.
fromrandomimportrandintclassTestDataEmptyArray(object):@staticmethoddefget_array():# complete this functionreturn[]classTestDataUniqueValues(object):data=set()whilelen(data)<10:data.add(randint(0,100))@staticmethoddefget_array():# complete this functiondata=TestDataUniqueValues.datareturnlist(data)@staticmethoddefget_expected_result():# complete this functiondata=TestDataUniqueValues.get_array()returndata.index(min(data))classTestDataExactlyTwoDifferentMinimums(object):data=set()whilelen(data)<9:data.add(randint(0,100))newData=list(data)newData.append(min(newData))@staticmethoddefget_array():# complete this functiondata=TestDataExactlyTwoDifferentMinimums.newDatareturndata@staticmethoddefget_expected_result():# complete this functiondata=TestDataExactlyTwoDifferentMinimums.get_array()returndata.index(min(data))
Day 27: Testing
You are viewing a single comment's thread. Return to all comments →
Python 3 solution
Passed all test cases. Not the cleanest but I don't see any other python solutions here.