getting nzec in k fib solving in python

can someone point out mistake in my solution here is the link to solution:-

as far as i am able to find it has something to do with input because this ( of mine got AC :slight_smile: but can someone explain me what was wrong in my code before. As far as i understand input() is taking a string so it take is take n and k both at the same time, is it possible to take input sequentially like as we do in c++
correct me if i am wrong i am new to python please share some resources for getting started with python that would be very awesome

Yeah you can do it like that
n,k = [int (x) for x in input ().split ()]

1 Like

could you explain this syntax @chhekur

This is called List Comprehension. In it this is just taking input as string but it splitting values by space and assign to variables,
Here I used two variable because, I have to take two values in different variable. But if you use a single variable like this N = [int(x) for x in input().split()] it will create a list of all values and assign to N.

1 Like