Or2
V2EX  ›  问与答

请问这个能用 reduce+map 来写么?

  •  
  •   Or2 · Feb 9, 2020 · 1418 views
    This topic created in 2460 days ago, the information mentioned may be changed or developed.
    def Func(x, a, b):
        a, b = x+a+b, 2*(x+a+b)
        return a, b
    
    A, B = 0, 0
    for X in [0,1,2]:
        A, B = Func(X, A, B)
        print(A, B)
    

    想了半天,没想出来

    2 replies  •  2020-02-09 14:13:29 +08:00
    6IbA2bj5ip3tK49j
    6IbA2bj5ip3tK49j
    Feb 9, 2020
    1
    能
    Or2
    Or2
    OP
    Feb 9, 2020
    2
    @xgfan 咋写阿?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4899 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 94ms · UTC 06:50 · PVG 14:50 · LAX 22:50 · JFK 01:50
    ♥ Do have faith in what you're doing.