Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python triangular number

def triangular_number(n):
    return n * (n + 1) // 2  # Convert to int for Python 2
Source by codereview.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #python #triangular #number
ADD COMMENT
Topic
Name
2+1 =