You are not logged in. Please login at to post your questions!


getting nzec in k fib solving in python

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

asked 31 Jan '18, 03:01

bhpra's gravatar image

accept rate: 12%

as far as i am able to find it has something to do with input because this ( 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★

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


answered 31 Jan '18, 12:57

chhekur's gravatar image

accept rate: 0%

could you explain this syntax @chhekur

(31 Jan '18, 13:22) bhpra2★

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • 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:


question asked: 31 Jan '18, 03:01

question was seen: 184 times

last updated: 31 Jan '18, 13:47