2017-12-23 7 views
-3

저는 파이썬에서 새롭습니다.함수 안에있는 두 개의 벡터

내부에 두 개의 벡터가있는 함수를 만들고 싶습니다. 나는이

def twovectors((velocity1,length1),(velocity2,length2)): 

같은 시도하지만,

SyntaxError: invalid syntax.

하시기 바랍니다 같은 메시지 오류가 도움이 필요합니다.

답변

-1

는이 방법으로 파이썬에서 함수를 작성 : 당신은 매개 변수로 함수 정의에 튜플을 넣을 수 없습니다

def twovectors(velocity1, velocity2): 
    # You can get the length of those vectors after you get inside the function 
    len1, len2 = len(velocity1), len(velocity2) 
    // Your code here 

    return whateveryouwantto