Or2
V2EX  ›  问与答

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

  •  
  •   Or2 · Feb 9, 2020 · 1354 views
    This topic created in 2372 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   ·   923 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 19:49 · PVG 03:49 · LAX 12:49 · JFK 15:49
    ♥ Do have faith in what you're doing.