Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2018-10-28 12:40:01
Size: 824
Comment:
Revision 6 as of 2019-10-09 17:18:08
Size: 824
Comment:
No differences found!

[ edit ]

  • プログラムの本質的な部分は,下記の 2 行 と 5 行 の関数定義です.

  • 三角数: n × (n + 1) /2

def triangle_number( n ):
    return( int( n * (n + 1) / 2 ) )

def sum_of_one_to_n( n ):
    sum = 0
    for i in range( 1, n+1 ):
        sum += i
    return( sum )

SoftEng: Python/Prog/Example/02/Ex_003a/Digest (last edited 2019-10-09 17:18:08 by TadashiIijima)