Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
GoogleCodindQues.py
#python 3.5.2 #This problem was recently asked by Google. #Given a list of numbers and a number k, return whether any two numbers from the list add up to k. #For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. #Bonus: Can you do this in one pass?*/ b=fun(235,10,15,3,7) print(b) def fun(key,list): i=0 while i<len(list)-1: j=len(list)-1 temp=list[i] while j>i: if temp+list[j]==key: return True j-=1 i+=1 return False b=fun(235,[10,15,3,7]) print(b)
run
|
edit
|
history
|
help
0
gj
test3.py
PyRegSearch
Game4
L5- part b
:progrm end
problem
PyEq
pyCustomEnum
func mast