Find the sequence number of a triangular number | Python3 code to print sequence number of a triangular number ; if N is not tringular number
import math NEW_LINE N = 21 NEW_LINE A = math . sqrt ( 2 * N + 0.25 ) - 0.5 NEW_LINE B = int ( A ) NEW_LINE if B != A : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( B ) NEW_LINE DEDENT