Guidelines

λ§€κ°œλ³€μˆ˜(Parameter)와 인자(Argument)의 차이점

  1. λ§€κ°œλ³€μˆ˜ (Parameter):

    • ν•¨μˆ˜λ₯Ό μ •μ˜ν•  λ•Œ μ‚¬μš©λ˜λŠ” λ³€μˆ˜μ˜ μ΄λ¦„μž…λ‹ˆλ‹€.
    • ν•¨μˆ˜κ°€ 호좜될 λ•Œ μ „λ‹¬λ˜λŠ” μ‹€μ œ κ°’μœΌλ‘œ μ΄ˆκΈ°ν™”λ©λ‹ˆλ‹€.
    • 예λ₯Ό λ“€μ–΄, def greet(name):μ—μ„œ name은 λ§€κ°œλ³€μˆ˜μž…λ‹ˆλ‹€.
  2. 인자 (Argument):

    • ν•¨μˆ˜λ₯Ό ν˜ΈμΆœν•  λ•Œ μ‹€μ œλ‘œ μ „λ‹¬λ˜λŠ” κ°’μž…λ‹ˆλ‹€.
    • ν•¨μˆ˜μ— μ „λ‹¬λ˜μ–΄ λ§€κ°œλ³€μˆ˜κ°€ μ°Έμ‘°ν•˜λŠ” μ‹€μ œ 데이터가 λ©λ‹ˆλ‹€.
    • 예λ₯Ό λ“€μ–΄, greet("CodeFriends")μ—μ„œ "CodeFriends"λŠ” μΈμžμž…λ‹ˆλ‹€.

κ°„λ‹¨νžˆ 말해, λ§€κ°œλ³€μˆ˜λŠ” ν•¨μˆ˜κ°€ μ •μ˜λ  λ•Œ μ½”λ“œ 싀행을 μœ„ν•΄ 이름이 μ§€μ •λœ λ³€μˆ˜μ΄λ©°, μΈμžλŠ” ν•¨μˆ˜κ°€ 호좜될 λ•Œ κ·Έ ν•¨μˆ˜μ— μ „λ‹¬λ˜λŠ” μ‹€μ œ κ°’μž…λ‹ˆλ‹€.

ν•¨μˆ˜μ˜ μ •μ˜μ™€ λ§€κ°œλ³€μˆ˜ μ˜ˆμ‹œ
def add(x, y): # x, yλŠ” λ§€κ°œλ³€μˆ˜ return x + y result = add(3, 5) # 3, 5λŠ” 인자 print(result) # 8

Guidelines

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Execution Result