human
Program to find sum of first n natural numbers | Returns sum of first n natural numbers.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to program to find sum of first n natural numbers and the other steps required.
 def findSum ( n ) :
	sum = 0
	x = 1
	while x <= n :
		sum = sum + x
		x = x + 1
	return sum
n = 5
print findSum ( n )