day 8-2 python (위치와 키워드)

2023. 3. 10. 10:01개인적인 공부/Python

위치 함수

## 2개의 파라미터를 생성하고 출력

def greet_with(name,location):
    print(f"Hello {name}")
    print(f"What is it like in {location}")
greet_with("kartejin", "Korea") ## Positional Argument

 

 

## 2개의 파라미터를 생성하고 출력

def greet_with(name,location):
    print(f"Hello {name}")
    print(f"What is it like in {location}")
greet_with("Korea", "karatejin")

키워드 함수

## Keywrod Arg

def greet_with(name,location):
    print(f"Hello {name}")
    print(f"What is it like in {location}")
greet_with(location= "Korea", name="Karatejin") ## Keyword Argument

이렇게 키워드로 지정면 순서가 바뀌어도 지정한 곳으로 감.

'개인적인 공부 > Python' 카테고리의 다른 글

day 8-3 python (페인트 면적 계산기)  (0) 2023.03.10
day 8-1 python (입력 값이 있는 함수)  (0) 2023.03.10
day 7-3 hangman  (0) 2023.03.10
day 7-2 hangman  (1) 2023.03.10
day 7-1 hangman  (0) 2023.03.10