Write a function is_triangular that meets the specification below. A triangular number is a number obtained by the continued summation of integers starting from 1. For example, 1, 1+2, 1+2+3, 1+2+3+4, etc., corresponding to 1, 3, 6, 10, etc., are triangular numbers.
"""
def is_triangular(k):
"""
k, a positive integer
returns True if k is triangular and False if not
"""
mylist = []
num = 0
n = 2
while n >= 2:
num = sum(range(1,n))
n += 1
mylist.append(num)
if num >= k:
break
return k in mylist
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.