×

# getting nzec in k fib solving in python

 0 can someone point out mistake in my solution here is the link to solution:-https://www.codechef.com/viewsolution/17201354 asked 31 Jan '18, 03:01 2★bhpra 103●6 accept rate: 12% 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 :) 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 (31 Jan '18, 10:53) bhpra2★

 1 Yeah you can do it like that n,k = [int (x) for x in input ().split ()] answered 31 Jan '18, 12:57 1★chhekur 23●3 accept rate: 0% could you explain this syntax @chhekur (31 Jan '18, 13:22) bhpra2★ 1 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. (31 Jan '18, 13:46) chhekur1★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×419
×262
×5

question asked: 31 Jan '18, 03:01

question was seen: 184 times

last updated: 31 Jan '18, 13:47