複数の戻り値
🟢 Python
投稿日: 2026年4月11日15:34
numbers=[14, 32, 80, 1, 9]
def sum_and_avg(nums):
total = sum(nums)
avg = total / len(nums)
return total, avg
total, avg = sum_and_avg(numbers)
VBAでは戻り値に配列を設定する。
Pythonでは、カンマで区切るだけ。タプルで返ってくる。
Pythonでは、カンマで区切るだけ。タプルで返ってくる。
No Comment