For loop - Python practice program

For loop - Python practice program:

Copy and try on your own.
1) Display sum 1 to 10 number by using for loop

    code:
    '''Display sum 1 to 10 number by using for loop'''
    n=10
    ans=0
    for i in range(1,n+1):
        ans+=i
    print("Sum of 1 to 10 number using for loop:",ans)

While loop - Python practice programs

While loop - Python practice programs:

Copy and try on your own.
1) Find first n numbers divisible by 5 using while loop

    code:
    '''first n numbers divisible by 5'''
    n=int(input("Enter n:"))
    while(n>0):
        if n%5 == 0:
            print(n, end=',')

        n-=1