Write a program which allows the user to enter a list of numbers.
Write a program which allows the user to enter a list of numbers,then works out whether there are any two numbers in the list which sum to 100.Hint:you could loop through the numbers in the list,and for each number,loop through the list again looking for a number that adds to it to make 100.However,there are other ways to do this too.
人气:328 ℃ 时间:2020-04-16 15:23:42
解答
def checkio(data, target):data.sort()i = 0j = len(data)-1while(i < j):if data[i] + data[j] > target:j -= 1elif d...
推荐
猜你喜欢
- 若方程组2x=y+32kx+(k+1)y=10的解互为相反数,则k的值为_.
- mexico city is located where the aztec empire had its capital several hunderd years ago.
- 若x、y为实数,y={√(x²-4)+√(4-x²)+1}/(x-2),则4y-3x的平方根是多少?
- (1)霍金认为,命运对他来说并非那么残酷,因为他拥有______,拥有______,拥有______,拥有______,拥有______·········
- 七年级数学1-3+5-7+9-11+……+97-99=?
- 从方框中选择正确的词,并用其适当形式填空 (choose ,celebrate ,wide ,except ,hardly) It’
- 显示器上AUTO/SET是什么意思
- 给英语的48个音标各写出3个例词拜托了各位