Sum of n natural numbers using while loop in python

Sum of n natural numbers using while loop in python. In Python programming language, the sum of natural numbers. The natural numbers will be printed by this Python application. This software is essentially an extension program, but it adds in advanced features

num = 18
if num < 0:
print("Sum of the natural number")
else:
sum = 0
while(num > 0):
sum += num
num -= 1
print("The sum is", sum)

Output

The sum is 171