Or2
V2EX  ›  问与答

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

  •  
  •   Or2 · Feb 9, 2020 · 1352 views
    This topic created in 2365 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
        1
    6IbA2bj5ip3tK49j  
       Feb 9, 2020
    Or2
        2
    Or2  
    OP
       Feb 9, 2020
    @xgfan 咋写阿?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2659 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 04:48 · PVG 12:48 · LAX 21:48 · JFK 00:48
    ♥ Do have faith in what you're doing.