Computer Science, asked by queensp73, 10 months ago


def Sum(Count):
S=0
for I in range(1,Count+1):
S+=I
return S
print(Sum(2))
print(Sum(5))

run this program nd give me the out put !!!
plzz helps guys .......

Answers

Answered by rishavsharma21pd1prg
2

Answer:

I HOPE IT HELPS

MARK ME BRAINLIEST

Attachments:
Answered by Anonymous
2

Answer:

3

15

Explanation:

def Sum(Count):

S=0

for I in range(1, Count+1):

S+=I

return S

print(Sum(2))

print(Sum(5))

#output:

3

15

The proofs of the execution is given in the attachments!

Purpose of the program:

this python program intends to calculate the sum of natural numbers till Count.

Some additional information:

*the above type of the python is classified as return type, parametrized function.so, during function imvoke,the value returned must be either directly be taken in print statement or should be stored in the suitable data type.

*the indention must be taken care of in python.otherwise,the logical error may creep in.

*python lets to return more than one values at at time unlike java and C++ which indeed is a pros of python.

Attachments:
Similar questions