[ edit ]

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)