コード例 #1
0
def maxProduction(market, maxWeight, i, actualMilk, actualWeight, cows):
    if (i < len(market)):
        # hasta comprobar la última vaca
        aCow = market[index]
        if (actualWeight + aCow.weight <= maxWeight):
            #insertamos la vaca, dependiendo de la cantidad de la leche
            return max(
                maxProduction(market, maxWeight, index + 1,
                              actualMilk + aCow.milk,
                              actualWeight + aCow.weight, cows + [aCow]),
                maxProduction(market, maxWeight, i + 1, actualMilk,
                              actualWeight, cows))
        else:
            #no insertamos la vaca actual
            return maxProduction(market, maxWeight, i + 1, actualMilk,
                                 actualWeight, cows)
        #devolvemos el resultado
    return [actualMilk, actualWeight, cows]
コード例 #2
0
ファイル: test.py プロジェクト: TheWolfMan-debug/python
from max import max
import os

if __name__ == '__main__':
    a = 1
    b = -1
    print(max(a, b))

    try:
        # f_path = os.getcwd() + r"\my_txt.txt"
        f = open(r"E:\python_program\python_program\test01\my_txt.txt")
        print(f.read())
        f.close()
    except Exception:
        os.system("pause")

    os.system("pause")
コード例 #3
0
def test_two():
    assert max([1, 2, 9, 3, 7, 1]) == 9
コード例 #4
0
def test_one():
    assert max([1, 2, 3, 7, 1]) == 7
コード例 #5
0
def test_five():
    assert max([1]) == 1
コード例 #6
0
def test_four():
    assert max([9, 1, 2, 3, 7, 1]) == 9
コード例 #7
0
def test_three():
    assert max([1, 2, 3, 7, 1, 9]) == 9
コード例 #8
0
ファイル: pos.py プロジェクト: Jarvistonychen/cvxpy
def pos(x):
    """ Alias for max{x,0}.
    
    """
    return max(x,0)
コード例 #9
0
ファイル: test_max.py プロジェクト: mate-academy/py_max
def test_list():
    assert max.max([2, 1, 5, 4, 7]) == 7
コード例 #10
0
ファイル: test_max.py プロジェクト: mate-academy/py_max
def test_empty():
    assert max.max([1]) == 1
コード例 #11
0
ファイル: pos.py プロジェクト: HapeMask/cvxpy
def pos(x):
    return max(x,0)
コード例 #12
0
# import mymodule
# print(mymodule.e)
# print(mymodule.p)
# mymodule.kent_tver()

# a = mymodule.person['name']
# print(a)

# from mymodule import person
# print(person['age'])

# import platform
# x = platform.system()
# print(x)

# from factorial import factorial
# print(factorial(3))

# from fibonaci import fibonaci
# fibonaci(50)

from max import max
print(max([1, 2, 3]))
コード例 #13
0
ファイル: 22.py プロジェクト: ug2454/PythonPractice
import max

numbers = [19, 20, 30]
print(max.max(numbers))
コード例 #14
0
def pos(x):
    """ Alias for max{x,0}.
    
    """
    return max(x, 0)
コード例 #15
0
import max
a = raw_input('请输入第一个数字:')
b = raw_input('请输入第二个数字:')
max.max(a, b)
コード例 #16
0
ファイル: test_max.py プロジェクト: mate-academy/py_max
def test_equal():
    assert max.max([1, 1, 1, 1]) == 1
コード例 #17
0
import max

a = raw_input("请输入第一个数字:")
b = raw_input("请输入第二个数字:")
max.max(a, b)