0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

#Python基礎(関数)

Posted at

#1.関数
Pythonの関数について簡単にメモ

# 掛け算をする関数
def product(a, b):
    c = a * b
    return c

print(product(10,2))

[出力]
20

  • 引数にデフォルト値を設定
# 掛け算をする関数
def product(a, b = 3):
    c = a * b
    return c

print(product(10))

[出力]
30

  • 引数にタプルを渡す方法
# 掛け算をする関数
def product(a, b ,c):
    d = a * b * c
    return d

val = (10,2,3)
print(product(*val))

[出力]
60

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?