C – Python – 017

C – Python – 017: Please convert the following C code to Python so that the Python program executes successfully passing the test cases.

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int N, X;
    scanf("%d%d", &N, &X);
    for(int ctr = 1; ctr <= X; ctr++)
    {
        N += printf("%d", N);
        printf(" ");
    }
    return 0;
}

Python Code:

a,b=map(int,input().split())
for i in range(1,b+1):
    print(a,end=" ")
    a+=len(str(a))

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts. You may also be interested in.