getting nzec in k fib solving in python

kfib
nzec
python3

#1

can someone point out mistake in my solution here is the link to solution:-https://www.codechef.com/viewsolution/17201354


#2

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


#3

as far as i am able to find it has something to do with input because this (https://www.codechef.com/viewsolution/17201888)solution 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++
cin>>n
cin>>k
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


#4

could you explain this syntax @chhekur


#5

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.