Python
21.01.14 javapython 수업 9일차
파이썬함수 함수를 호출할 때 매개변수를 지정하여 호출 입력되는 값의 개수에 따라 동적으로 처리 12345678910111213def total(*args): # Tuple 형태로 저장 total = 0 for n in args: total += n return total num = total(1, 2, 3)print(num) num = total(1, 2, 3, 4, 5)print(num)cs 키워드 파라미터매개변수명이 지정된 입력값을 개수에 따라 동적으로 처리 1234def func(**kwargs): # Dictionary 형태로 저장 print(kwargs) func(a=1, b=2, c=3)cs 결과값의 여러가지 반환 형태2개 이상의 값 반환 - 파이썬이라 가능 12345678def funcB()..
2021. 1. 14. 18:05
최근댓글