Answers for "ho to choose numbers for getting a sum of n numbers in python"

1

program to find sum till n natural numbers in python

#sum of natural number till n.
n=int(input('no. :'))
gross=0
no=0
while no < n:
    no+=1
    gross+=no
    print('no.', no ,'sum of n', gross)
print('no.',n,'total',gross)
Posted by: Guest on December-11-2021
0

python sum only numbers

def SumNum(mylist):
    the_sum = sum(filter(lambda i: isinstance(i, (int, long, float)), mylist))
    return the_sum
Posted by: Guest on August-20-2021

Code answers related to "ho to choose numbers for getting a sum of n numbers in python"

Python Answers by Framework

Browse Popular Code Answers by Language