Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Python3 complete func.
#python 3.4.3 #Run on: http://rextester.com/TRC76278 def complete(w): dict = ('database','datatable','datagrid','colspan','columns','color','test','map','myth') matches = [s for s in dict if s.find(w) is 0] if( len(matches) is 0 ): return '' elif( len(matches) is 1 ): return matches[0] min_match = min(matches) matches.remove(min_match) #? result = '' for i,v in enumerate(min_match): for m in matches: if(m[i] is not v): return result result += v return result _input = 'c' print( 'Input: ' , _input ) print( 'Result:' , complete( _input ) ) """ Input: c Result: col """
run
|
edit
|
history
|
help
0
Square numbers
BasicFunctionsPrograms,py
lab00.py
Itc
innerclass.py
PyBoolNone
15
hi1
Game4
short hand if else