- プログラミングのお題スレ Part7 [転載禁止]©2ch.net
305 :デフォルトの名無しさん[sage]:2015/06/20(土) 12:55:33.69 ID:fq3+jKQo - >>304 Python
def odai(input): def func(max_num, cur_num): return '_' * (cur_num - 1) + 'Hello,\n' + func(max_num, cur_num + 1) + '_' * (cur_num - 1) + 'world!\n' if max_num >= cur_num else '' return func(input, 1) print odai(1) print odai(3) print odai(10) ●実行結果 https://ideone.com/qSk50s
| - プログラミングのお題スレ Part7 [転載禁止]©2ch.net
306 :305[sage]:2015/06/20(土) 12:57:37.15 ID:fq3+jKQo - インデント消えた・・・
def odai(input): def func(max_num, cur_num): return '_' * (cur_num - 1) + 'Hello,\n' + func(max_num, cur_num + 1) + '_' * (cur_num - 1) + 'world!\n' if max_num >= cur_num else '' return func(input, 1)
|
|